diff options
Diffstat (limited to 'toxcore/DHT.c')
-rw-r--r-- | toxcore/DHT.c | 11 |
1 files 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) | |||
128 | static int client_in_list(Client_data *list, uint32_t length, uint8_t *client_id) | 128 | static int client_in_list(Client_data *list, uint32_t length, uint8_t *client_id) |
129 | { | 129 | { |
130 | uint32_t i; | 130 | uint32_t i; |
131 | uint64_t temp_time = unix_time(); | ||
131 | 132 | ||
132 | for (i = 0; i < length; i++) | 133 | for (i = 0; i < length; i++) |
133 | if (id_equal(list[i].client_id, client_id)) | 134 | #ifdef CLIENT_ONETOONE_IP /* Dead nodes are considered dead (not in the list)*/ |
134 | return 1; | 135 | if (!is_timeout(temp_time, list[i].assoc.timestamp, KILL_NODE_TIMEOUT)) |
136 | #else | ||
137 | if (!is_timeout(temp_time, list[i].assoc4.timestamp, KILL_NODE_TIMEOUT) || | ||
138 | !is_timeout(temp_time, list[i].assoc6.timestamp, KILL_NODE_TIMEOUT)) | ||
139 | #endif | ||
140 | if (id_equal(list[i].client_id, client_id)) | ||
141 | return 1; | ||
135 | 142 | ||
136 | return 0; | 143 | return 0; |
137 | } | 144 | } |