From: Martin Schwenke Date: Fri, 6 Mar 2020 05:11:23 +0000 (+1100) Subject: ctdb-tcp: Do not stop outbound connection in ctdb_tcp_node_connect() X-Git-Tag: samba-4.10.14~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7936eab41d72c06d7629cc4bd807891a15e7f2d;p=thirdparty%2Fsamba.git ctdb-tcp: Do not stop outbound connection in ctdb_tcp_node_connect() The only place the outgoing connection needs to be stopped is when there is a timeout when waiting for the connection to become writable. Add a new function ctdb_tcp_node_connect_timeout() to handle this case. All of the other cases are attempts to establish a new outgoing connection (initial attempt, retry after an error or disconnect, ...) so drop stopping the connection in those cases. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14295 Signed-off-by: Amitay Isaacs Signed-off-by: Martin Schwenke Autobuild-User(master): Martin Schwenke Autobuild-Date(master): Thu Mar 12 05:29:20 UTC 2020 on sn-devel-184 (cherry picked from commit 319c93f0c6a949545229b616dfbd4f51baf11171) Autobuild-User(v4-10-test): Karolin Seeger Autobuild-Date(v4-10-test): Tue Mar 24 10:48:31 UTC 2020 on sn-devel-144 --- diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c index 6065829a44e..6ce3dc16a6d 100644 --- a/ctdb/tcp/tcp_connect.c +++ b/ctdb/tcp/tcp_connect.c @@ -161,6 +161,11 @@ static void ctdb_node_connect_write(struct tevent_context *ev, } +static void ctdb_tcp_node_connect_timeout(struct tevent_context *ev, + struct tevent_timer *te, + struct timeval t, + void *private_data); + /* called when we should try and establish a tcp connection to a node */ @@ -251,7 +256,7 @@ static void ctdb_tcp_start_outgoing(struct ctdb_node *node) tnode->connect_te = tevent_add_timer(ctdb->ev, tnode, timeval_current_ofs(1, 0), - ctdb_tcp_node_connect, + ctdb_tcp_node_connect_timeout, node); return; @@ -273,6 +278,17 @@ void ctdb_tcp_node_connect(struct tevent_context *ev, struct ctdb_node *node = talloc_get_type_abort(private_data, struct ctdb_node); + ctdb_tcp_start_outgoing(node); +} + +static void ctdb_tcp_node_connect_timeout(struct tevent_context *ev, + struct tevent_timer *te, + struct timeval t, + void *private_data) +{ + struct ctdb_node *node = talloc_get_type_abort(private_data, + struct ctdb_node); + ctdb_tcp_stop_outgoing(node); ctdb_tcp_start_outgoing(node); }