mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Fixed possible problem.
This commit is contained in:
parent
2dd1c5515c
commit
d14ba73bc3
|
@ -128,10 +128,17 @@ static int is_timeout(uint64_t time_now, uint64_t timestamp, uint64_t timeout)
|
||||||
static int client_in_list(Client_data *list, uint32_t length, uint8_t *client_id)
|
static int client_in_list(Client_data *list, uint32_t length, uint8_t *client_id)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
uint64_t temp_time = unix_time();
|
||||||
|
|
||||||
for (i = 0; i < length; i++)
|
for (i = 0; i < length; i++)
|
||||||
if (id_equal(list[i].client_id, client_id))
|
#ifdef CLIENT_ONETOONE_IP /* Dead nodes are considered dead (not in the list)*/
|
||||||
return 1;
|
if (!is_timeout(temp_time, list[i].assoc.timestamp, KILL_NODE_TIMEOUT))
|
||||||
|
#else
|
||||||
|
if (!is_timeout(temp_time, list[i].assoc4.timestamp, KILL_NODE_TIMEOUT) ||
|
||||||
|
!is_timeout(temp_time, list[i].assoc6.timestamp, KILL_NODE_TIMEOUT))
|
||||||
|
#endif
|
||||||
|
if (id_equal(list[i].client_id, client_id))
|
||||||
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user