]> git.meshlink.io Git - meshlink/commitdiff
Also send the blacklist notification when we already have a connection.
authorGuus Sliepen <guus@meshlink.io>
Thu, 29 Oct 2020 22:38:22 +0000 (23:38 +0100)
committerGuus Sliepen <guus@meshlink.io>
Thu, 29 Oct 2020 22:38:22 +0000 (23:38 +0100)
Instead of just closing the connection, and having to wait for the
reconnection to happen to send the blacklist notification, we do it
immediately when meshlink_blacklist() is called.

src/meshlink.c

index ee62078d8b16a55a31c363eb3d77f01fdbdb5b63..c34b24c9643f4bde69e2904877502e78c01f2b86 100644 (file)
@@ -3456,6 +3456,10 @@ static bool blacklist(meshlink_handle_t *mesh, node_t *n) {
         */
        for list_each(connection_t, c, mesh->connections) {
                if(c->node == n) {
+                       if(c->status.active) {
+                               send_error(mesh, c, BLACKLISTED, "blacklisted");
+                       }
+
                        shutdown(c->socket, SHUT_RDWR);
                }
        }