summaryrefslogtreecommitdiff
path: root/src/routing.c
diff options
context:
space:
mode:
authorJesper Jensen <jesper@jnsn.dev>2025-05-06 19:31:48 +0200
committerJesper Jensen <jesper@jnsn.dev>2025-05-06 19:31:48 +0200
commit63a28d5951594455e050ea3a68ab5b63cb093964 (patch)
treeef66acd00ed0ff6a2e700870ebbd09f5ad9fb2d3 /src/routing.c
parent8c04d112dd3c63ee0a618bec5d24877797fb6d3a (diff)
Reset the expire time of routing table on startup
Diffstat (limited to 'src/routing.c')
-rw-r--r--src/routing.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/routing.c b/src/routing.c
index 30f0deb..a3e0b26 100644
--- a/src/routing.c
+++ b/src/routing.c
@@ -73,12 +73,6 @@ void routing_update_metrics() {
prom_gauge_set(routing_table_occupied, filled, (const char*[]){buf});
}
-
- time_t reasonable = time(NULL) + 120;
- for(size_t i = 0; i < RT_SIZE; i++) {
- if(pTable->table[i].set) continue;
- if(reasonable < pTable->table[i].expire) dbg("%d will expire quite far into the future after now? (%ld < %ld)", i, reasonable, pTable->table[i].expire);
- }
}
void routing_flush() {
@@ -300,6 +294,18 @@ void routing_oldest(struct entry** dest) {
}
}
+void routing_reset_expire(time_t expire) {
+ for(struct entry* entry = pTable->table; entry < pTable->table+RT_SIZE; entry++){
+ if(!entry->set)
+ continue;
+
+ if(entry->expire != 0)
+ continue;
+
+ entry->expire = expire;
+ }
+}
+
void routing_status(int* filled, int* size, double* load_factor, size_t load_factor_len) {
*size = RT_SIZE;