mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Only set dht public key and direct ip when first creating connection.
Check if ip family is valid in set_direct_ip_port() function.
This commit is contained in:
parent
a8b7ddc1a3
commit
33e5c34aaf
|
@ -2413,13 +2413,13 @@ void do_friends(Messenger *m)
|
|||
}
|
||||
}
|
||||
|
||||
friend_new_connection(m, i, m->friendlist[i].client_id);
|
||||
|
||||
if (friend_new_connection(m, i, m->friendlist[i].client_id) == 0) {
|
||||
if (m->friendlist[i].dht_lock)
|
||||
set_connection_dht_public_key(m->net_crypto, m->friendlist[i].crypt_connection_id, m->friendlist[i].dht_temp_pk,
|
||||
current_time_monotonic());
|
||||
|
||||
set_direct_ip_port(m->net_crypto, m->friendlist[i].crypt_connection_id, m->friendlist[i].dht_ip_port);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1700,6 +1700,9 @@ int set_direct_ip_port(Net_Crypto *c, int crypt_connection_id, IP_Port ip_port)
|
|||
if (conn == 0)
|
||||
return -1;
|
||||
|
||||
if (ip_port.ip.family != AF_INET && ip_port.ip.family != AF_INET6)
|
||||
return -1;
|
||||
|
||||
if (!ipport_equal(&ip_port, &conn->ip_port)) {
|
||||
if (bs_list_add(&c->ip_port_list, &ip_port, crypt_connection_id)) {
|
||||
bs_list_remove(&c->ip_port_list, &conn->ip_port, crypt_connection_id);
|
||||
|
|
Loading…
Reference in New Issue
Block a user