From: Martin Schwenke Date: Mon, 30 Sep 2024 02:37:57 +0000 (+1000) Subject: ctdb-server: Handle pre-existing connection first X-Git-Tag: tdb-1.4.13~632 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5af8627feb805b65b9bf28a295f2f7f81f5f8826;p=thirdparty%2Fsamba.git ctdb-server: Handle pre-existing connection first This is cheap when tcparray is NULL and let's the code that now follows be simplified. Signed-off-by: Martin Schwenke Reviewed-by: Volker Lendecke Reviewed-by: Jerry Heyman --- diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c index cc575fdda94..50bd512d0ef 100644 --- a/ctdb/server/ctdb_takeover.c +++ b/ctdb/server/ctdb_takeover.c @@ -1547,6 +1547,12 @@ int32_t ctdb_control_tcp_add(struct ctdb_context *ctdb, tcparray = vnn->tcp_array; + /* Do we already have this tickle ?*/ + if (ctdb_tcp_find(tcparray, p) != NULL) { + DBG_DEBUG("Already had connection %s\n", conn_str); + return 0; + } + /* If this is the first tickle */ if (tcparray == NULL) { tcparray = talloc(vnn, struct ctdb_tcp_array); @@ -1568,13 +1574,6 @@ int32_t ctdb_control_tcp_add(struct ctdb_context *ctdb, return 0; } - - /* Do we already have this tickle ?*/ - if (ctdb_tcp_find(tcparray, p) != NULL) { - DBG_DEBUG("Already had connection %s\n", conn_str); - return 0; - } - /* A new tickle, we must add it to the array */ tcparray->connections = talloc_realloc(tcparray, tcparray->connections,