]> git.meshlink.io Git - meshlink/blobdiff - src/meshlink.c
Clear reachability times in host config files received during a join.
[meshlink] / src / meshlink.c
index 0bec2f8aaf831c2cfd663f36fb7c0f97a7155633..d1987ab8c1ebfe36deb62cec72c043e814f6ef48 100644 (file)
@@ -668,6 +668,10 @@ static bool finalize_join(meshlink_handle_t *mesh, const void *buf, uint16_t len
                        }
                }
 
+               /* Clear the reachability times, since we ourself have never seen these nodes yet */
+               n->last_reachable = 0;
+               n->last_unreachable = 0;
+
                if(!node_write_config(mesh, n)) {
                        free_node(n);
                        return false;
@@ -720,7 +724,7 @@ static bool invitation_receive(void *handle, uint8_t type, const void *msg, uint
                return finalize_join(mesh, msg, len);
 
        case 1:
-               logger(mesh, MESHLINK_DEBUG, "Invitation succesfully accepted.\n");
+               logger(mesh, MESHLINK_DEBUG, "Invitation successfully accepted.\n");
                shutdown(mesh->sock, SHUT_RDWR);
                mesh->success = true;
                break;
@@ -2428,7 +2432,7 @@ char *meshlink_invite_ex(meshlink_handle_t *mesh, meshlink_submesh_t *submesh, c
        }
 
        // Ensure no other nodes know about this name
-       if(meshlink_get_node(mesh, name)) {
+       if(lookup_node(mesh, name)) {
                logger(mesh, MESHLINK_ERROR, "A node with name %s is already known!\n", name);
                meshlink_errno = MESHLINK_EEXIST;
                pthread_mutex_unlock(&mesh->mutex);
@@ -2454,7 +2458,7 @@ char *meshlink_invite_ex(meshlink_handle_t *mesh, meshlink_submesh_t *submesh, c
        // If we changed our own host config file, write it out now
        if(mesh->self->status.dirty) {
                if(!node_write_config(mesh, mesh->self)) {
-                       logger(mesh, MESHLINK_ERROR, "Could not write our own host conifg file!\n");
+                       logger(mesh, MESHLINK_ERROR, "Could not write our own host config file!\n");
                        pthread_mutex_unlock(&mesh->mutex);
                        return NULL;
                }