diff options
Diffstat (limited to 'toxcore/Messenger.c')
-rw-r--r-- | toxcore/Messenger.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 2c7dcdee..b0d5a2e5 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -2200,13 +2200,22 @@ void do_friends(Messenger *m) | |||
2200 | } | 2200 | } |
2201 | 2201 | ||
2202 | friend_new_connection(m, i, m->friendlist[i].client_id); | 2202 | friend_new_connection(m, i, m->friendlist[i].client_id); |
2203 | uint8_t dht_public_key[crypto_box_PUBLICKEYBYTES]; | 2203 | } |
2204 | 2204 | ||
2205 | if (m->friendlist[i].crypt_connection_id != -1) { | ||
2206 | uint8_t dht_public_key[crypto_box_PUBLICKEYBYTES]; | ||
2205 | uint64_t timestamp = onion_getfriend_DHT_pubkey(m->onion_c, m->friendlist[i].onion_friendnum, dht_public_key); | 2207 | uint64_t timestamp = onion_getfriend_DHT_pubkey(m->onion_c, m->friendlist[i].onion_friendnum, dht_public_key); |
2208 | |||
2206 | if (timestamp != 0) { | 2209 | if (timestamp != 0) { |
2207 | set_connection_dht_public_key(m->net_crypto, m->friendlist[i].crypt_connection_id, dht_public_key, timestamp); | 2210 | set_connection_dht_public_key(m->net_crypto, m->friendlist[i].crypt_connection_id, dht_public_key, timestamp); |
2208 | } | 2211 | } |
2209 | 2212 | ||
2213 | timestamp = get_connection_dht_key(m->net_crypto, m->friendlist[i].crypt_connection_id, dht_public_key); | ||
2214 | |||
2215 | if (timestamp != 0) { | ||
2216 | onion_set_friend_DHT_pubkey(m->onion_c, m->friendlist[i].onion_friendnum, dht_public_key, timestamp); | ||
2217 | } | ||
2218 | |||
2210 | uint8_t direct_connected; | 2219 | uint8_t direct_connected; |
2211 | unsigned int status = crypto_connection_status(m->net_crypto, m->friendlist[i].crypt_connection_id, &direct_connected); | 2220 | unsigned int status = crypto_connection_status(m->net_crypto, m->friendlist[i].crypt_connection_id, &direct_connected); |
2212 | 2221 | ||