summaryrefslogtreecommitdiff
path: root/toxcore
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-01-20 21:01:56 -0500
committerirungentoo <irungentoo@gmail.com>2014-01-20 21:01:56 -0500
commitbba5176f28dac1e9d528414cb43dec2ae478a8e1 (patch)
tree919d25999d50909be24086ff237375cc497ab0cb /toxcore
parent8421e44ffbdcc157a8a46f4604e8823b3d9a9c5e (diff)
Adjusted some timeouts and fixed possible memory leak.
Diffstat (limited to 'toxcore')
-rw-r--r--toxcore/DHT.c5
-rw-r--r--toxcore/Messenger.c3
-rw-r--r--toxcore/onion_client.c10
3 files changed, 16 insertions, 2 deletions
diff --git a/toxcore/DHT.c b/toxcore/DHT.c
index 61ec5034..b736d55e 100644
--- a/toxcore/DHT.c
+++ b/toxcore/DHT.c
@@ -2286,6 +2286,11 @@ void kill_DHT(DHT *dht)
2286#ifdef ENABLE_ASSOC_DHT 2286#ifdef ENABLE_ASSOC_DHT
2287 kill_Assoc(dht->assoc); 2287 kill_Assoc(dht->assoc);
2288#endif 2288#endif
2289 networking_registerhandler(dht->net, NET_PACKET_GET_NODES, NULL, NULL);
2290 networking_registerhandler(dht->net, NET_PACKET_SEND_NODES, NULL, NULL);
2291 networking_registerhandler(dht->net, NET_PACKET_SEND_NODES_IPV6, NULL, NULL);
2292 cryptopacket_registerhandler(dht->c, CRYPTO_PACKET_NAT_PING, NULL, NULL);
2293 cryptopacket_registerhandler(dht->c, CRYPTO_PACKET_HARDENING, NULL, NULL);
2289 kill_ping(dht->ping); 2294 kill_ping(dht->ping);
2290 free(dht->friends_list); 2295 free(dht->friends_list);
2291 free(dht); 2296 free(dht);
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c
index 19246d7d..c1301767 100644
--- a/toxcore/Messenger.c
+++ b/toxcore/Messenger.c
@@ -1581,6 +1581,9 @@ void kill_messenger(Messenger *m)
1581 for (i = 0; i < numchats; ++i) 1581 for (i = 0; i < numchats; ++i)
1582 del_groupchat(m, i); 1582 del_groupchat(m, i);
1583 1583
1584 kill_onion(m->onion);
1585 kill_onion_announce(m->onion_a);
1586 kill_onion_client(m->onion_c);
1584 kill_DHT(m->dht); 1587 kill_DHT(m->dht);
1585 kill_net_crypto(m->net_crypto); 1588 kill_net_crypto(m->net_crypto);
1586 kill_networking(m->net); 1589 kill_networking(m->net);
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c
index cfdd7254..825c6b98 100644
--- a/toxcore/onion_client.c
+++ b/toxcore/onion_client.c
@@ -711,6 +711,8 @@ int onion_set_friend_online(Onion_Client *onion_c, int friend_num, uint8_t is_on
711 * return -1 on failure 711 * return -1 on failure
712 * return 0 on success 712 * return 0 on success
713 * 713 *
714 * TODO: Make this function better, it currently might be vulnerable to some attacks that
715 * could de anonimize us.
714 */ 716 */
715int random_path(Onion_Client *onion_c, Node_format *nodes) 717int random_path(Onion_Client *onion_c, Node_format *nodes)
716{ 718{
@@ -720,7 +722,7 @@ int random_path(Onion_Client *onion_c, Node_format *nodes)
720 return 0; 722 return 0;
721} 723}
722 724
723#define ANNOUNCE_FRIEND 120 725#define ANNOUNCE_FRIEND 90
724 726
725static void do_friend(Onion_Client *onion_c, uint16_t friendnum) 727static void do_friend(Onion_Client *onion_c, uint16_t friendnum)
726{ 728{
@@ -775,7 +777,7 @@ void oniondata_registerhandler(Onion_Client *onion_c, uint8_t byte, oniondata_ha
775} 777}
776 778
777#define ANNOUNCE_INTERVAL_NOT_ANNOUNCED 10 779#define ANNOUNCE_INTERVAL_NOT_ANNOUNCED 10
778#define ANNOUNCE_INTERVAL_ANNOUNCED 120 780#define ANNOUNCE_INTERVAL_ANNOUNCED 90
779 781
780static void do_announce(Onion_Client *onion_c) 782static void do_announce(Onion_Client *onion_c)
781{ 783{
@@ -854,7 +856,11 @@ void kill_onion_client(Onion_Client *onion_c)
854 if (onion_c == NULL) 856 if (onion_c == NULL)
855 return; 857 return;
856 858
859 realloc_onion_friends(onion_c, 0);
857 networking_registerhandler(onion_c->net, NET_PACKET_ANNOUNCE_RESPONSE, NULL, NULL); 860 networking_registerhandler(onion_c->net, NET_PACKET_ANNOUNCE_RESPONSE, NULL, NULL);
858 networking_registerhandler(onion_c->net, NET_PACKET_ONION_DATA_RESPONSE, NULL, NULL); 861 networking_registerhandler(onion_c->net, NET_PACKET_ONION_DATA_RESPONSE, NULL, NULL);
862 oniondata_registerhandler(onion_c, FAKEID_DATA_ID, NULL, NULL);
863 cryptopacket_registerhandler(onion_c->dht->c, FAKEID_DATA_ID, NULL, NULL);
864 memset(onion_c, 0, sizeof(Onion_Client));
859 free(onion_c); 865 free(onion_c);
860} 866}