From d230c01c0609529332eb72ae1b65f0ddddd515a0 Mon Sep 17 00:00:00 2001 From: Jesper Jensen Date: Wed, 7 May 2025 23:01:47 +0200 Subject: Transfer the id after loading it --- src/main.c | 1 + src/routing.c | 5 +++++ src/routing.h | 1 + 3 files changed, 7 insertions(+) (limited to 'src') diff --git a/src/main.c b/src/main.c index f984763..11e39bd 100644 --- a/src/main.c +++ b/src/main.c @@ -156,6 +156,7 @@ int main(int argc, char** argv) { routing_init(&myID); allocate_hashtable(); } else { + routing_setid(&myID); routing_reset_expire(time(NULL) + PROTO_UNCTM); } diff --git a/src/routing.c b/src/routing.c index a3e0b26..02b2f03 100644 --- a/src/routing.c +++ b/src/routing.c @@ -58,6 +58,11 @@ void routing_init(struct nodeid* myid) { routing_flush(); } +void routing_setid(struct nodeid *id) { + pTable->myID = *id; + myID = pTable->myID; +} + void routing_update_metrics() { char buf[4]; // Largest value is 157 + \0 diff --git a/src/routing.h b/src/routing.h index aee2c8e..2d53b80 100644 --- a/src/routing.h +++ b/src/routing.h @@ -37,6 +37,7 @@ extern struct entry *table; extern int table_size; void routing_init(struct nodeid* myid); +void routing_setid(struct nodeid *id); void routing_update_metrics(); void routing_flush(); bool routing_interested(struct nodeid* id); -- cgit v1.2.3