mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
More DHT fixes.
This commit is contained in:
parent
5fe8429da8
commit
7494c65bee
|
@ -63,7 +63,7 @@
|
||||||
#define NAT_PING_RESPONSE 1
|
#define NAT_PING_RESPONSE 1
|
||||||
|
|
||||||
/* Number of get node requests to send to quickly find close nodes. */
|
/* 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.
|
/* 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);
|
memcpy(pk_bak, nodes_list[i].public_key, crypto_box_PUBLICKEYBYTES);
|
||||||
ip_port_bak = nodes_list[i].ip_port;
|
ip_port_bak = nodes_list[i].ip_port;
|
||||||
memcpy(nodes_list[i].public_key, pk, crypto_box_PUBLICKEYBYTES);
|
memcpy(nodes_list[i].public_key, pk, crypto_box_PUBLICKEYBYTES);
|
||||||
|
nodes_list[i].ip_port = ip_port;
|
||||||
|
|
||||||
if (i != (length - 1))
|
if (i != (length - 1))
|
||||||
add_to_list(nodes_list, length, pk_bak, ip_port_bak, cmp_pk);
|
add_to_list(nodes_list, length, pk_bak, ip_port_bak, cmp_pk);
|
||||||
|
|
|
@ -1439,7 +1439,10 @@ void do_onion_client(Onion_Client *onion_c)
|
||||||
if (onion_c->last_run == unix_time())
|
if (onion_c->last_run == unix_time())
|
||||||
return;
|
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_isconnected(onion_c)) {
|
||||||
if (onion_c->onion_connected < ONION_CONNECTION_SECONDS * 2) {
|
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);
|
_Bool UDP_connected = DHT_non_lan_connected(onion_c->dht);
|
||||||
|
|
||||||
if (is_timeout(onion_c->first_run, ONION_CONNECTION_SECONDS)) {
|
if (is_timeout(onion_c->first_run, ONION_CONNECTION_SECONDS * 2)) {
|
||||||
populate_path_nodes(onion_c);
|
|
||||||
set_tcp_onion_status(onion_c->c->tcp_c, !UDP_connected);
|
set_tcp_onion_status(onion_c->c->tcp_c, !UDP_connected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user