From: David Bauer Date: Wed, 29 Sep 2021 17:05:44 +0000 (+0200) Subject: node: save created time for node X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=d0cd65b7624a2e90a9c3ae6d902b19b94aad2786;p=project%2Fusteer.git node: save created time for node 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 --- diff --git a/local_node.c b/local_node.c index 103e5ee..c237b2f 100644 --- a/local_node.c +++ b/local_node.c @@ -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; diff --git a/remote.c b/remote.c index 4887cc0..282e39b 100644 --- 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; diff --git a/usteer.h b/usteer.h index 1b9d12c..cd83c78 100644 --- 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 {