diff options
| author | Jesper Jensen <jesper@jnsn.dev> | 2025-05-07 23:01:47 +0200 |
|---|---|---|
| committer | Jesper Jensen <jesper@jnsn.dev> | 2025-05-07 23:01:47 +0200 |
| commit | d230c01c0609529332eb72ae1b65f0ddddd515a0 (patch) | |
| tree | 446a0f79335da46150f1e82ab3080bf5e8ed94fc | |
| parent | ddc816a34861a0e090ea84fc945842593c34f45a (diff) | |
Transfer the id after loading it
| -rw-r--r-- | src/main.c | 1 | ||||
| -rw-r--r-- | src/routing.c | 5 | ||||
| -rw-r--r-- | src/routing.h | 1 |
3 files changed, 7 insertions, 0 deletions
@@ -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); |
