summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2015-12-11 17:44:21 -0500
committerirungentoo <irungentoo@gmail.com>2015-12-11 17:44:21 -0500
commit7494c65bee705450a0fbf507c54c612c1df301a2 (patch)
tree8093b9cbf79eeb2d6b1bb58b808eebb05627ac3b
parent5fe8429da8dfb15cb5ff25118886c48d71d2d251 (diff)
More DHT fixes.
-rw-r--r--toxcore/DHT.c3
-rw-r--r--toxcore/onion_client.c8
2 files changed, 7 insertions, 4 deletions
diff --git a/toxcore/DHT.c b/toxcore/DHT.c
index 2220b1d7..84a245bb 100644
--- a/toxcore/DHT.c
+++ b/toxcore/DHT.c
@@ -63,7 +63,7 @@
63#define NAT_PING_RESPONSE 1 63#define NAT_PING_RESPONSE 1
64 64
65/* Number of get node requests to send to quickly find close nodes. */ 65/* Number of get node requests to send to quickly find close nodes. */
66#define MAX_BOOTSTRAP_TIMES 10 66#define MAX_BOOTSTRAP_TIMES 20
67 67
68/* Compares pk1 and pk2 with pk. 68/* Compares pk1 and pk2 with pk.
69 * 69 *
@@ -486,6 +486,7 @@ static _Bool add_to_list(Node_format *nodes_list, unsigned int length, const uin
486 memcpy(pk_bak, nodes_list[i].public_key, crypto_box_PUBLICKEYBYTES); 486 memcpy(pk_bak, nodes_list[i].public_key, crypto_box_PUBLICKEYBYTES);
487 ip_port_bak = nodes_list[i].ip_port; 487 ip_port_bak = nodes_list[i].ip_port;
488 memcpy(nodes_list[i].public_key, pk, crypto_box_PUBLICKEYBYTES); 488 memcpy(nodes_list[i].public_key, pk, crypto_box_PUBLICKEYBYTES);
489 nodes_list[i].ip_port = ip_port;
489 490
490 if (i != (length - 1)) 491 if (i != (length - 1))
491 add_to_list(nodes_list, length, pk_bak, ip_port_bak, cmp_pk); 492 add_to_list(nodes_list, length, pk_bak, ip_port_bak, cmp_pk);
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c
index 11a7b629..05767c74 100644
--- a/toxcore/onion_client.c
+++ b/toxcore/onion_client.c
@@ -1439,7 +1439,10 @@ void do_onion_client(Onion_Client *onion_c)
1439 if (onion_c->last_run == unix_time()) 1439 if (onion_c->last_run == unix_time())
1440 return; 1440 return;
1441 1441
1442 do_announce(onion_c); 1442 if (is_timeout(onion_c->first_run, ONION_CONNECTION_SECONDS)) {
1443 populate_path_nodes(onion_c);
1444 do_announce(onion_c);
1445 }
1443 1446
1444 if (onion_isconnected(onion_c)) { 1447 if (onion_isconnected(onion_c)) {
1445 if (onion_c->onion_connected < ONION_CONNECTION_SECONDS * 2) { 1448 if (onion_c->onion_connected < ONION_CONNECTION_SECONDS * 2) {
@@ -1456,8 +1459,7 @@ void do_onion_client(Onion_Client *onion_c)
1456 1459
1457 _Bool UDP_connected = DHT_non_lan_connected(onion_c->dht); 1460 _Bool UDP_connected = DHT_non_lan_connected(onion_c->dht);
1458 1461
1459 if (is_timeout(onion_c->first_run, ONION_CONNECTION_SECONDS)) { 1462 if (is_timeout(onion_c->first_run, ONION_CONNECTION_SECONDS * 2)) {
1460 populate_path_nodes(onion_c);
1461 set_tcp_onion_status(onion_c->c->tcp_c, !UDP_connected); 1463 set_tcp_onion_status(onion_c->c->tcp_c, !UDP_connected);
1462 } 1464 }
1463 1465