summaryrefslogtreecommitdiff
path: root/src/routing.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/routing.c')
-rw-r--r--src/routing.c8
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