mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Removed now useless code.
This commit is contained in:
parent
207e87187d
commit
116f3d46e8
|
@ -334,7 +334,6 @@ static int client_ping_nodes(Onion_Client *onion_c, uint32_t num, Node_format *n
|
|||
|
||||
Onion_Node *list_nodes = NULL;
|
||||
uint8_t *reference_id = NULL;
|
||||
uint32_t *ping_nodes_sent_second = NULL;
|
||||
|
||||
Last_Pinged *last_pinged = NULL;
|
||||
uint8_t *last_pinged_index = NULL;
|
||||
|
@ -342,13 +341,11 @@ static int client_ping_nodes(Onion_Client *onion_c, uint32_t num, Node_format *n
|
|||
if (num == 0) {
|
||||
list_nodes = onion_c->clients_announce_list;
|
||||
reference_id = onion_c->c->self_public_key;
|
||||
ping_nodes_sent_second = &onion_c->ping_nodes_sent_second;
|
||||
last_pinged = onion_c->last_pinged;
|
||||
last_pinged_index = &onion_c->last_pinged_index;
|
||||
} else {
|
||||
list_nodes = onion_c->friends_list[num - 1].clients_list;
|
||||
reference_id = onion_c->friends_list[num - 1].real_client_id;
|
||||
ping_nodes_sent_second = &onion_c->friends_list[num - 1].ping_nodes_sent_second;
|
||||
last_pinged = onion_c->friends_list[num - 1].last_pinged;
|
||||
last_pinged_index = &onion_c->friends_list[num - 1].last_pinged_index;
|
||||
}
|
||||
|
@ -358,9 +355,6 @@ static int client_ping_nodes(Onion_Client *onion_c, uint32_t num, Node_format *n
|
|||
|
||||
for (i = 0; i < num_nodes; ++i) {
|
||||
|
||||
if (*ping_nodes_sent_second > MAX_PING_NODES_SECOND_PEER)
|
||||
return 0;
|
||||
|
||||
if (!lan_ips_accepted)
|
||||
if (LAN_ip(nodes[i].ip_port.ip) == 0)
|
||||
continue;
|
||||
|
@ -375,8 +369,7 @@ static int client_ping_nodes(Onion_Client *onion_c, uint32_t num, Node_format *n
|
|||
}
|
||||
|
||||
if (j == MAX_ONION_CLIENTS && good_to_ping(last_pinged, last_pinged_index, nodes[i].client_id)) {
|
||||
if (client_send_announce_request(onion_c, num, nodes[i].ip_port, nodes[i].client_id, NULL, ~0) == 0)
|
||||
++*ping_nodes_sent_second;
|
||||
client_send_announce_request(onion_c, num, nodes[i].ip_port, nodes[i].client_id, NULL, ~0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1073,10 +1066,8 @@ void do_onion_client(Onion_Client *onion_c)
|
|||
for (i = 0; i < onion_c->num_friends; ++i) {
|
||||
do_friend(onion_c, i);
|
||||
cleanup_friend(onion_c, i);
|
||||
onion_c->friends_list[i].ping_nodes_sent_second = 0;
|
||||
}
|
||||
|
||||
onion_c->ping_nodes_sent_second = 0;
|
||||
onion_c->last_run = unix_time();
|
||||
}
|
||||
|
||||
|
|
|
@ -44,11 +44,6 @@
|
|||
#define ONION_PATH_TIMEOUT 30
|
||||
#define ONION_PATH_MAX_LIFETIME 600
|
||||
|
||||
/* A cheap way of making it take less bandwidth at startup:
|
||||
by limiting the number of ping packets we can send per
|
||||
second per peer. */
|
||||
#define MAX_PING_NODES_SECOND_PEER 5
|
||||
|
||||
#define MAX_STORED_PINGED_NODES 9
|
||||
#define MIN_NODE_PING_TIME 10
|
||||
|
||||
|
@ -98,7 +93,6 @@ typedef struct {
|
|||
uint64_t last_seen;
|
||||
|
||||
Onion_Client_Paths onion_paths;
|
||||
uint32_t ping_nodes_sent_second;
|
||||
|
||||
Last_Pinged last_pinged[MAX_STORED_PINGED_NODES];
|
||||
uint8_t last_pinged_index;
|
||||
|
@ -127,8 +121,6 @@ typedef struct {
|
|||
uint8_t temp_public_key[crypto_box_PUBLICKEYBYTES];
|
||||
uint8_t temp_secret_key[crypto_box_SECRETKEYBYTES];
|
||||
|
||||
uint32_t ping_nodes_sent_second;
|
||||
|
||||
Last_Pinged last_pinged[MAX_STORED_PINGED_NODES];
|
||||
|
||||
Ping_Array announce_ping_array;
|
||||
|
|
Loading…
Reference in New Issue
Block a user