]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-server: Handle pre-existing connection first
authorMartin Schwenke <mschwenke@ddn.com>
Mon, 30 Sep 2024 02:37:57 +0000 (12:37 +1000)
committerMartin Schwenke <martins@samba.org>
Wed, 6 Nov 2024 23:03:42 +0000 (23:03 +0000)
This is cheap when tcparray is NULL and let's the code that now
follows be simplified.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jerry Heyman <jheyman@ddn.com>
ctdb/server/ctdb_takeover.c

index cc575fdda94a9a624788a68992914b97b085123a..50bd512d0ef1a5afd0c7f7257ae23cf1b67b19a6 100644 (file)
@@ -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,