summaryrefslogtreecommitdiff
path: root/ctdb/tools/ctdb_killtcp.c
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2016-03-23 08:26:36 +1100
committerAmitay Isaacs <amitay@samba.org>2016-04-01 04:42:12 +0200
commit93f3cd66506373d842dc2dc7a1a678109410ac8e (patch)
tree40ba58b0d898be96976a4d0b5804d1af315f2a3a /ctdb/tools/ctdb_killtcp.c
parent402f3c0460f072c316bc8f0b28c2adf7164b513c (diff)
downloadsamba-93f3cd66506373d842dc2dc7a1a678109410ac8e.tar.gz
ctdb-killtcp: Don't count attempts for individual connections
This made sense when connections were individually queued in the daemon. However, they're now done in batch so just keep an overall count. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/tools/ctdb_killtcp.c')
-rw-r--r--ctdb/tools/ctdb_killtcp.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/ctdb/tools/ctdb_killtcp.c b/ctdb/tools/ctdb_killtcp.c
index b305b71efb4..b1898d73eda 100644
--- a/ctdb/tools/ctdb_killtcp.c
+++ b/ctdb/tools/ctdb_killtcp.c
@@ -51,7 +51,6 @@ static const char *prog;
struct ctdb_killtcp_con {
ctdb_sock_addr src_addr;
ctdb_sock_addr dst_addr;
- int count;
struct ctdb_kill_tcp *killtcp;
};
@@ -171,14 +170,6 @@ static int tickle_connection_traverse(void *param, void *data)
{
struct ctdb_killtcp_con *con = talloc_get_type(data, struct ctdb_killtcp_con);
- /* have tried too many times, just give up */
- if (con->count >= con->killtcp->max_attempts) {
- /* can't delete in traverse: reparent to delete_cons */
- talloc_steal(param, con);
- return 0;
- }
-
- con->count++;
ctdb_sys_send_tcp(&con->dst_addr, &con->src_addr, 0, 0, 0);
return 0;
@@ -203,11 +194,12 @@ static void ctdb_tickle_sentenced_connections(struct tevent_context *ev,
killtcp->attempts++;
- /* If there are no more connections to kill we can remove the
- entire killtcp structure
+ /* If there are no more connections to kill or we have tried
+ too many times we can remove the entire killtcp structure
*/
- if ((killtcp->connections == NULL) ||
- (killtcp->connections->root == NULL)) {
+ if (killtcp->connections == NULL ||
+ killtcp->connections->root == NULL ||
+ killtcp->attempts >= killtcp->max_attempts) {
talloc_free(killtcp);
return;
}
@@ -279,7 +271,6 @@ static int ctdb_killtcp(struct tevent_context *ev,
}
con->src_addr = *src;
con->dst_addr = *dst;
- con->count = 0;
con->killtcp = killtcp;