diff options
Diffstat (limited to 'toxcore/friend_connection.c')
-rw-r--r-- | toxcore/friend_connection.c | 11 |
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 | ||