ctdb-tcp: add ctdb_tcp_stop_incoming()
authorRalph Boehme <slow@samba.org>
Sat, 29 Feb 2020 10:54:51 +0000 (11:54 +0100)
committerKarolin Seeger <kseeger@samba.org>
Thu, 19 Mar 2020 10:56:09 +0000 (10:56 +0000)
No change in behaviour.  This makes the code self-documenting.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14295

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit 2c73dbafba50b28e72a8ec7b4382fae42fca6d17)

ctdb/tcp/ctdb_tcp.h
ctdb/tcp/tcp_connect.c
ctdb/tcp/tcp_init.c

index 095056e8544544c56753cc16dfe8d9744eb09673..cb8d66fa5dcd705379e618cac64172da8426d137 100644 (file)
@@ -49,6 +49,7 @@ void ctdb_tcp_node_connect(struct tevent_context *ev, struct tevent_timer *te,
 void ctdb_tcp_read_cb(uint8_t *data, size_t cnt, void *args);
 void ctdb_tcp_tnode_cb(uint8_t *data, size_t cnt, void *private_data);
 void ctdb_tcp_stop_outgoing(struct ctdb_node *node);
+void ctdb_tcp_stop_incoming(struct ctdb_node *node);
 
 #define CTDB_TCP_ALIGNMENT 8
 
index 757c41dc7031b388a7d6128193be04e4bb1c196d..4732a8d612bbd5421ca41fcc2875ab068a639cb2 100644 (file)
@@ -54,6 +54,16 @@ void ctdb_tcp_stop_outgoing(struct ctdb_node *node)
        }
 }
 
+/*
+  stop incoming connection to a node
+ */
+void ctdb_tcp_stop_incoming(struct ctdb_node *node)
+{
+       struct ctdb_tcp_node *tnode = talloc_get_type(
+               node->transport_data, struct ctdb_tcp_node);
+
+       TALLOC_FREE(tnode->in_queue);
+}
 
 /*
   called when a complete packet has come in - should not happen on this socket
index c6acb166807035f5f9d5b3547a66007bb8144349..97ebe1d887a7c47535f7ea22e7317e991f3fb477 100644 (file)
@@ -121,7 +121,7 @@ static void ctdb_tcp_restart(struct ctdb_node *node)
                node->transport_data, struct ctdb_tcp_node);
 
        DEBUG(DEBUG_NOTICE,("Tearing down connection to dead node :%d\n", node->pnn));
-       TALLOC_FREE(tnode->in_queue);
+       ctdb_tcp_stop_incoming(node);
        ctdb_tcp_stop_outgoing(node);
 
        tnode->connect_te = tevent_add_timer(node->ctdb->ev, tnode,