mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
reset hole-punching parameters after not punching for a while
This commit is contained in:
parent
7077662e32
commit
9e43d678fb
|
@ -46,6 +46,9 @@
|
||||||
/* Interval in seconds between punching attempts*/
|
/* Interval in seconds between punching attempts*/
|
||||||
#define PUNCH_INTERVAL 3
|
#define PUNCH_INTERVAL 3
|
||||||
|
|
||||||
|
/* Time in seconds after which punching parameters will be reset */
|
||||||
|
#define PUNCH_RESET_TIME 40
|
||||||
|
|
||||||
#define MAX_NORMAL_PUNCHING_TRIES 5
|
#define MAX_NORMAL_PUNCHING_TRIES 5
|
||||||
|
|
||||||
#define NAT_PING_REQUEST 0
|
#define NAT_PING_REQUEST 0
|
||||||
|
@ -2129,6 +2132,12 @@ static void do_NAT(DHT *dht)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dht->friends_list[i].nat.punching_timestamp + PUNCH_RESET_TIME < temp_time) {
|
||||||
|
dht->friends_list[i].nat.tries = 0;
|
||||||
|
dht->friends_list[i].nat.punching_index = 0;
|
||||||
|
dht->friends_list[i].nat.punching_index2 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t port_list[MAX_FRIEND_CLIENTS];
|
uint16_t port_list[MAX_FRIEND_CLIENTS];
|
||||||
uint16_t numports = NAT_getports(port_list, ip_list, num, ip);
|
uint16_t numports = NAT_getports(port_list, ip_list, num, ip);
|
||||||
punch_holes(dht, ip, port_list, numports, i);
|
punch_holes(dht, ip, port_list, numports, i);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user