summaryrefslogtreecommitdiff
path: root/toxcore/friend_connection.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2015-05-19 19:55:43 -0400
committerirungentoo <irungentoo@gmail.com>2015-05-19 19:55:43 -0400
commit815725ab843618e1008819fe1449d8473627a114 (patch)
tree264699c0601dbd4fbf11e6bd891a7a9a59b256cb /toxcore/friend_connection.c
parent19192920249965fda8931e667bfbffddaeba502c (diff)
Some fixes.
Diffstat (limited to 'toxcore/friend_connection.c')
-rw-r--r--toxcore/friend_connection.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/toxcore/friend_connection.c b/toxcore/friend_connection.c
index 7dd8e3e3..1656def0 100644
--- a/toxcore/friend_connection.c
+++ b/toxcore/friend_connection.c
@@ -158,17 +158,12 @@ int friend_add_tcp_relay(Friend_Connections *fr_c, int friendcon_id, IP_Port ip_
158 if (!friend_con) 158 if (!friend_con)
159 return -1; 159 return -1;
160 160
161 /* Local ip means that they are hosting a TCP relay. */ 161 /* Local ip and same pk means that they are hosting a TCP relay. */
162 if (Local_ip(ip_port.ip)) { 162 if (Local_ip(ip_port.ip) && memcmp(friend_con->dht_temp_pk, public_key, crypto_box_PUBLICKEYBYTES) == 0) {
163 if (friend_con->dht_ip_port.ip.family != 0) { 163 if (friend_con->dht_ip_port.ip.family != 0) {
164 ip_port.ip = friend_con->dht_ip_port.ip; 164 ip_port.ip = friend_con->dht_ip_port.ip;
165 } else { 165 } else {
166 if (memcmp(friend_con->dht_temp_pk, public_key, crypto_box_PUBLICKEYBYTES) == 0) { 166 friend_con->hosting_tcp_relay = 0;
167 friend_con->hosting_tcp_relay = 0;
168 return 0;
169 } else {
170 return -1;
171 }
172 } 167 }
173 } 168 }
174 169