diff options
| author | Jesper Jensen <jesper@jnsn.dev> | 2025-05-10 16:40:42 +0200 |
|---|---|---|
| committer | Jesper Jensen <jesper@jnsn.dev> | 2025-05-10 16:40:42 +0200 |
| commit | 89ef4c5c3bdc65862bffcffb7e9e21103d4e8bb4 (patch) | |
| tree | 925515267f0634c5586c6f3cc1c5b496be56f856 /src/proto.c | |
| parent | 84ac4433045ba3ccd389ce0d3a9e573c1da30f7c (diff) | |
Run the lookup once in a while
Diffstat (limited to 'src/proto.c')
| -rw-r--r-- | src/proto.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/proto.c b/src/proto.c index cff3a6a..df47cbb 100644 --- a/src/proto.c +++ b/src/proto.c @@ -919,8 +919,6 @@ int proto_run(struct dht* dht, char* buff, size_t recv_len, struct sockaddr_in* } if(dht->lookup.state == OP_PENDING) { - dht->lookup.timeout = now + 120; - for(size_t i = 0; i < 8; i++) { dht->lookup.closest_addr[i].port = 0; } @@ -939,9 +937,11 @@ int proto_run(struct dht* dht, char* buff, size_t recv_len, struct sockaddr_in* assert(rc == 0); } + dht->lookup.timeout = now + 120; dht->lookup.state = OP_ACTIVE; prom_counter_inc(lookup_count, NULL); } else if(dht->lookup.state == OP_ACTIVE && dht->lookup.timeout <= now) { + dht->lookup.timeout = now + 3600; dht->lookup.state = OP_COMPLETED; } |
