]> git.meshlink.io Git - meshlink/commitdiff
Sync host config file immediately after initial connect.
authorGuus Sliepen <guus@meshlink.io>
Fri, 24 Jan 2020 20:08:01 +0000 (21:08 +0100)
committerGuus Sliepen <guus@meshlink.io>
Fri, 24 Jan 2020 20:08:01 +0000 (21:08 +0100)
src/graph.c

index 18376c14956a619a9e99441365fd44c42a7cfa18..d70279c2e85b99f6a9f28a6ef7ed142dbfe68f7a 100644 (file)
@@ -175,7 +175,12 @@ static void check_reachability(meshlink_handle_t *mesh) {
 
                        if(n->status.reachable) {
                                logger(mesh, MESHLINK_DEBUG, "Node %s became reachable", n->name);
+                               bool first_time_reachable = !n->last_reachable;
                                n->last_reachable = mesh->loop.now.tv_sec;
+
+                               if(first_time_reachable) {
+                                       node_write_config(mesh, n);
+                               }
                        } else {
                                logger(mesh, MESHLINK_DEBUG, "Node %s became unreachable", n->name);
                                n->last_unreachable = mesh->loop.now.tv_sec;