Adjusted some timeouts and fixed possible memory leak.

This commit is contained in:
irungentoo 2014-01-20 21:01:56 -05:00
parent 8421e44ffb
commit bba5176f28
3 changed files with 16 additions and 2 deletions

View File

@ -2286,6 +2286,11 @@ void kill_DHT(DHT *dht)
#ifdef ENABLE_ASSOC_DHT
kill_Assoc(dht->assoc);
#endif
networking_registerhandler(dht->net, NET_PACKET_GET_NODES, NULL, NULL);
networking_registerhandler(dht->net, NET_PACKET_SEND_NODES, NULL, NULL);
networking_registerhandler(dht->net, NET_PACKET_SEND_NODES_IPV6, NULL, NULL);
cryptopacket_registerhandler(dht->c, CRYPTO_PACKET_NAT_PING, NULL, NULL);
cryptopacket_registerhandler(dht->c, CRYPTO_PACKET_HARDENING, NULL, NULL);
kill_ping(dht->ping);
free(dht->friends_list);
free(dht);

View File

@ -1581,6 +1581,9 @@ void kill_messenger(Messenger *m)
for (i = 0; i < numchats; ++i)
del_groupchat(m, i);
kill_onion(m->onion);
kill_onion_announce(m->onion_a);
kill_onion_client(m->onion_c);
kill_DHT(m->dht);
kill_net_crypto(m->net_crypto);
kill_networking(m->net);

View File

@ -711,6 +711,8 @@ int onion_set_friend_online(Onion_Client *onion_c, int friend_num, uint8_t is_on
* return -1 on failure
* return 0 on success
*
* TODO: Make this function better, it currently might be vulnerable to some attacks that
* could de anonimize us.
*/
int random_path(Onion_Client *onion_c, Node_format *nodes)
{
@ -720,7 +722,7 @@ int random_path(Onion_Client *onion_c, Node_format *nodes)
return 0;
}
#define ANNOUNCE_FRIEND 120
#define ANNOUNCE_FRIEND 90
static void do_friend(Onion_Client *onion_c, uint16_t friendnum)
{
@ -775,7 +777,7 @@ void oniondata_registerhandler(Onion_Client *onion_c, uint8_t byte, oniondata_ha
}
#define ANNOUNCE_INTERVAL_NOT_ANNOUNCED 10
#define ANNOUNCE_INTERVAL_ANNOUNCED 120
#define ANNOUNCE_INTERVAL_ANNOUNCED 90
static void do_announce(Onion_Client *onion_c)
{
@ -854,7 +856,11 @@ void kill_onion_client(Onion_Client *onion_c)
if (onion_c == NULL)
return;
realloc_onion_friends(onion_c, 0);
networking_registerhandler(onion_c->net, NET_PACKET_ANNOUNCE_RESPONSE, NULL, NULL);
networking_registerhandler(onion_c->net, NET_PACKET_ONION_DATA_RESPONSE, NULL, NULL);
oniondata_registerhandler(onion_c, FAKEID_DATA_ID, NULL, NULL);
cryptopacket_registerhandler(onion_c->dht->c, FAKEID_DATA_ID, NULL, NULL);
memset(onion_c, 0, sizeof(Onion_Client));
free(onion_c);
}