diff options
| author | Jesper Jensen <jesper@slashwin.dk> | 2021-10-02 00:25:37 +0200 |
|---|---|---|
| committer | Jesper Jensen <jesper@slashwin.dk> | 2021-10-02 00:26:52 +0200 |
| commit | e3eb0d2eda0bb8c4decf9bc56b025157e70387c2 (patch) | |
| tree | 5e2594399953f01e2725546193d9ed84c4527655 /src/routing.c | |
| parent | c46781095ec64fbc4f8cf6097ca70b594a68c583 (diff) | |
Add timeout handling
Diffstat (limited to 'src/routing.c')
| -rw-r--r-- | src/routing.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/routing.c b/src/routing.c index f26f1ba..1448f55 100644 --- a/src/routing.c +++ b/src/routing.c @@ -99,6 +99,8 @@ static uint16_t base_bucket(struct nodeid* id) { struct entry* routing_get(struct nodeid* id) { uint16_t baseIndex = base_bucket(id); for(size_t i = baseIndex; i < baseIndex + BUCKETSIZE; i++) { + if(!table[i].set) continue; + if(memcmp(&table[i].id, id, sizeof(struct nodeid)) == 0) { return &table[i]; } @@ -107,6 +109,12 @@ struct entry* routing_get(struct nodeid* id) { return NULL; } +void routing_remove(struct nodeid* id) { + struct entry* entry = routing_get(id); + + entry->set = false; +} + bool routing_interested(struct nodeid* id) { uint16_t bucketIndex = prefix(&myID, id); // The nodeid is the same as our own |
