Some fixes.

This commit is contained in:
irungentoo 2015-05-19 19:55:43 -04:00
parent 1919292024
commit 815725ab84
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98
2 changed files with 4 additions and 9 deletions

View File

@ -1186,7 +1186,7 @@ Suite *tox_suite(void)
DEFTESTCASE(one); DEFTESTCASE(one);
DEFTESTCASE_SLOW(few_clients, 50); DEFTESTCASE_SLOW(few_clients, 50);
DEFTESTCASE_SLOW(many_clients, 150); DEFTESTCASE_SLOW(many_clients, 150);
DEFTESTCASE_SLOW(many_clients_tcp, 150); DEFTESTCASE_SLOW(many_clients_tcp, 20);
DEFTESTCASE_SLOW(many_clients_tcp_b, 20); DEFTESTCASE_SLOW(many_clients_tcp_b, 20);
DEFTESTCASE_SLOW(many_group, 100); DEFTESTCASE_SLOW(many_group, 100);
return s; return s;

View File

@ -158,17 +158,12 @@ int friend_add_tcp_relay(Friend_Connections *fr_c, int friendcon_id, IP_Port ip_
if (!friend_con) if (!friend_con)
return -1; return -1;
/* Local ip means that they are hosting a TCP relay. */ /* Local ip and same pk means that they are hosting a TCP relay. */
if (Local_ip(ip_port.ip)) { if (Local_ip(ip_port.ip) && memcmp(friend_con->dht_temp_pk, public_key, crypto_box_PUBLICKEYBYTES) == 0) {
if (friend_con->dht_ip_port.ip.family != 0) { if (friend_con->dht_ip_port.ip.family != 0) {
ip_port.ip = friend_con->dht_ip_port.ip; ip_port.ip = friend_con->dht_ip_port.ip;
} else { } else {
if (memcmp(friend_con->dht_temp_pk, public_key, crypto_box_PUBLICKEYBYTES) == 0) { friend_con->hosting_tcp_relay = 0;
friend_con->hosting_tcp_relay = 0;
return 0;
} else {
return -1;
}
} }
} }