More DHT fixes.

This commit is contained in:
irungentoo 2015-12-11 17:44:21 -05:00
parent 5fe8429da8
commit 7494c65bee
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98
2 changed files with 7 additions and 4 deletions

View File

@ -63,7 +63,7 @@
#define NAT_PING_RESPONSE 1
/* Number of get node requests to send to quickly find close nodes. */
#define MAX_BOOTSTRAP_TIMES 10
#define MAX_BOOTSTRAP_TIMES 20
/* Compares pk1 and pk2 with pk.
*
@ -486,6 +486,7 @@ static _Bool add_to_list(Node_format *nodes_list, unsigned int length, const uin
memcpy(pk_bak, nodes_list[i].public_key, crypto_box_PUBLICKEYBYTES);
ip_port_bak = nodes_list[i].ip_port;
memcpy(nodes_list[i].public_key, pk, crypto_box_PUBLICKEYBYTES);
nodes_list[i].ip_port = ip_port;
if (i != (length - 1))
add_to_list(nodes_list, length, pk_bak, ip_port_bak, cmp_pk);

View File

@ -1439,7 +1439,10 @@ void do_onion_client(Onion_Client *onion_c)
if (onion_c->last_run == unix_time())
return;
do_announce(onion_c);
if (is_timeout(onion_c->first_run, ONION_CONNECTION_SECONDS)) {
populate_path_nodes(onion_c);
do_announce(onion_c);
}
if (onion_isconnected(onion_c)) {
if (onion_c->onion_connected < ONION_CONNECTION_SECONDS * 2) {
@ -1456,8 +1459,7 @@ void do_onion_client(Onion_Client *onion_c)
_Bool UDP_connected = DHT_non_lan_connected(onion_c->dht);
if (is_timeout(onion_c->first_run, ONION_CONNECTION_SECONDS)) {
populate_path_nodes(onion_c);
if (is_timeout(onion_c->first_run, ONION_CONNECTION_SECONDS * 2)) {
set_tcp_onion_status(onion_c->c->tcp_c, !UDP_connected);
}