diff options
Diffstat (limited to 'toxcore/Messenger.c')
-rw-r--r-- | toxcore/Messenger.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index b0d5a2e5..472c2ae4 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -2203,17 +2203,15 @@ void do_friends(Messenger *m) | |||
2203 | } | 2203 | } |
2204 | 2204 | ||
2205 | if (m->friendlist[i].crypt_connection_id != -1) { | 2205 | if (m->friendlist[i].crypt_connection_id != -1) { |
2206 | uint8_t dht_public_key[crypto_box_PUBLICKEYBYTES]; | 2206 | uint8_t dht_public_key1[crypto_box_PUBLICKEYBYTES]; |
2207 | uint64_t timestamp = onion_getfriend_DHT_pubkey(m->onion_c, m->friendlist[i].onion_friendnum, dht_public_key); | 2207 | uint64_t timestamp1 = onion_getfriend_DHT_pubkey(m->onion_c, m->friendlist[i].onion_friendnum, dht_public_key1); |
2208 | 2208 | uint8_t dht_public_key2[crypto_box_PUBLICKEYBYTES]; | |
2209 | if (timestamp != 0) { | 2209 | uint64_t timestamp2 = get_connection_dht_key(m->net_crypto, m->friendlist[i].crypt_connection_id, dht_public_key2); |
2210 | set_connection_dht_public_key(m->net_crypto, m->friendlist[i].crypt_connection_id, dht_public_key, timestamp); | 2210 | |
2211 | } | 2211 | if (timestamp1 > timestamp2) { |
2212 | 2212 | set_connection_dht_public_key(m->net_crypto, m->friendlist[i].crypt_connection_id, dht_public_key1, timestamp1); | |
2213 | timestamp = get_connection_dht_key(m->net_crypto, m->friendlist[i].crypt_connection_id, dht_public_key); | 2213 | } else if (timestamp1 < timestamp2) { |
2214 | 2214 | onion_set_friend_DHT_pubkey(m->onion_c, m->friendlist[i].onion_friendnum, dht_public_key2, timestamp2); | |
2215 | if (timestamp != 0) { | ||
2216 | onion_set_friend_DHT_pubkey(m->onion_c, m->friendlist[i].onion_friendnum, dht_public_key, timestamp); | ||
2217 | } | 2215 | } |
2218 | 2216 | ||
2219 | uint8_t direct_connected; | 2217 | uint8_t direct_connected; |