node: save created time for node
authorDavid Bauer <mail@david-bauer.net>
Wed, 29 Sep 2021 17:05:44 +0000 (19:05 +0200)
committerDavid Bauer <mail@david-bauer.net>
Thu, 25 Nov 2021 21:28:41 +0000 (22:28 +0100)
Save the timestamp of the node creation. This is required to optimize
the selection of most-roamed to neighbors relative to their creation
time.

Signed-off-by: David Bauer <mail@david-bauer.net>
local_node.c
remote.c
usteer.h

index 103e5eed2d862b08f2f7b635dd4189ffb96f42ff..c237b2fd2c9fbdebaeb2fd55a59b31b19f2478f6 100644 (file)
@@ -409,6 +409,7 @@ usteer_get_node(struct ubus_context *ctx, const char *name)
        ln = calloc_a(sizeof(*ln), &str, strlen(name) + 1);
        node = &ln->node;
        node->type = NODE_TYPE_LOCAL;
+       node->created = current_time;
        node->avl.key = strcpy(str, name);
        ln->ev.remove_cb = usteer_handle_remove;
        ln->ev.cb = usteer_handle_event;
index 4887cc023ddda9507927d82faa31b31914222ffd..282e39b3f290b3ea56abfda3ac81acaea53da24d 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -257,6 +257,7 @@ interface_get_node(struct usteer_remote_host *host, const char *name)
 
        node = calloc_a(sizeof(*node), &buf, addr_len + 1 + strlen(name) + 1);
        node->node.type = NODE_TYPE_REMOTE;
+       node->node.created = current_time;
 
        sprintf(buf, "%s#%s", host->addr, name);
        node->node.avl.key = buf;
index 1b9d12c017f459c60d710fc5e8b4f565ed56a0c4..cd83c78605c36f5163e89ecc38502d43f79d22da 100644 (file)
--- a/usteer.h
+++ b/usteer.h
@@ -90,6 +90,8 @@ struct usteer_node {
 
        int roam_source;
        int roam_destination;
+
+       uint64_t created;
 };
 
 struct usteer_scan_request {