diff options
author | irungentoo <irungentoo@gmail.com> | 2013-09-27 23:10:33 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-09-27 23:10:33 -0400 |
commit | d14ba73bc316211ec3e3e9a1600bda37b2bf2ae4 (patch) | |
tree | a986954e1b38c3b6c432eef1dd3e277de7f9cb2c /toxcore/DHT.c | |
parent | 2dd1c5515cd4199093e6a5b9d112dc588e5ec650 (diff) |
Fixed possible problem.
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 | } |