From d14ba73bc316211ec3e3e9a1600bda37b2bf2ae4 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Fri, 27 Sep 2013 23:10:33 -0400 Subject: [PATCH] Fixed possible problem. --- toxcore/DHT.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/toxcore/DHT.c b/toxcore/DHT.c index c3eb721d..1e6cc623 100644 --- a/toxcore/DHT.c +++ b/toxcore/DHT.c @@ -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) { uint32_t i; + uint64_t temp_time = unix_time(); for (i = 0; i < length; i++) - if (id_equal(list[i].client_id, client_id)) - return 1; +#ifdef CLIENT_ONETOONE_IP /* Dead nodes are considered dead (not in the list)*/ + 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; }