X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fmeshlink.c;h=dd571190d86f53b46965e7e2f2aa5be0dd62a174;hb=a5750efefc491d77ff6a45f0ebc21976831eebfe;hp=98e02f7db623d8c8b4e837eb96e77f23580fddd8;hpb=5678b294c5bbb61b983a7a269bc85fd6ea6590ff;p=meshlink diff --git a/src/meshlink.c b/src/meshlink.c index 98e02f7d..dd571190 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -2831,10 +2831,12 @@ void meshlink_blacklist(meshlink_handle_t *mesh, meshlink_node_t *node) { logger(mesh, MESHLINK_DEBUG, "Blacklisted %s.\n", node->name); - //Immediately terminate any connections we have with the blacklisted node + /* Immediately shut down any connections we have with the blacklisted node. + * We can't call terminate_connection(), because we might be called from a callback function. + */ for list_each(connection_t, c, mesh->connections) { if(c->node == n) { - terminate_connection(mesh, c, c->status.active); + shutdown(c->socket, SHUT_RDWR); } } @@ -2846,10 +2848,6 @@ void meshlink_blacklist(meshlink_handle_t *mesh, meshlink_node_t *node) { n->mtuprobes = 0; n->status.udp_confirmed = false; - if(n->status.reachable) { - update_node_status(mesh, n); - } - pthread_mutex_unlock(&mesh->mutex); }