From 89ed660067d0226201fef5172d4af4fada400210 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 30 May 2007 16:37:39 +1000 Subject: [PATCH] tell newly connected nodes about any tcp tickle records that we have that they don't have (This used to be ctdb commit 71dd59c1662d429d260c25090e0ca26db48d4075) --- ctdb/takeover/ctdb_takeover.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/ctdb/takeover/ctdb_takeover.c b/ctdb/takeover/ctdb_takeover.c index 94ac1a4c737..cadb1a80c34 100644 --- a/ctdb/takeover/ctdb_takeover.c +++ b/ctdb/takeover/ctdb_takeover.c @@ -463,6 +463,13 @@ int32_t ctdb_control_tcp_add(struct ctdb_context *ctdb, TDB_DATA indata) if (NULL == ctdb_tcp_find(ctdb->tcp_list, tcp)) { DLIST_ADD(ctdb->tcp_list, tcp); + DEBUG(2,("Added tickle info for %s:%u from vnn %u\n", + inet_ntoa(tcp->daddr.sin_addr), ntohs(tcp->daddr.sin_port), + tcp->vnn)); + } else { + DEBUG(4,("Already had tickle info for %s:%u from vnn %u\n", + inet_ntoa(tcp->daddr.sin_addr), ntohs(tcp->daddr.sin_port), + tcp->vnn)); } return 0; @@ -484,7 +491,11 @@ int32_t ctdb_control_tcp_remove(struct ctdb_context *ctdb, TDB_DATA indata) tcp = ctdb_tcp_find(ctdb->tcp_list, &t); if (tcp) { + DEBUG(2,("Removed tickle info for %s:%u from vnn %u\n", + inet_ntoa(tcp->daddr.sin_addr), ntohs(tcp->daddr.sin_port), + tcp->vnn)); DLIST_REMOVE(ctdb->tcp_list, tcp); + talloc_free(tcp); } return 0; @@ -503,6 +514,24 @@ int32_t ctdb_control_startup(struct ctdb_context *ctdb, uint32_t vnn) DLIST_REMOVE(ctdb->tcp_list, tcp); talloc_free(tcp); } + + /* and tell the new guy about any that he should have + from us */ + if (tcp->vnn == ctdb->vnn) { + struct ctdb_control_tcp_vnn t; + TDB_DATA data; + + t.vnn = tcp->vnn; + t.src = tcp->saddr; + t.dest = tcp->daddr; + + data.dptr = (uint8_t *)&t; + data.dsize = sizeof(t); + + ctdb_daemon_send_control(ctdb, vnn, 0, + CTDB_CONTROL_TCP_ADD, + 0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL); + } } return 0; } -- 2.47.3