Rev 364: when handing over an IP to another node,	also tell them of any tcp connections we were handling,	so they can send tickle acks for those connections in	http://samba.org/~tridge/ctdb ------------------------------------------------------------
revno: 364
revision-id: tridge@samba.org-20070527145110-4dwpd6btx287elvc
parent: tridge@samba.org-20070527143440-4hr0qbiyrynndwos
committer: Andrew Tridgell 
branch nick: tridge
timestamp: Mon 2007-05-28 00:51:10 +1000
message:
  when handing over an IP to another node, also tell them of any tcp connections we were handling, so they can send tickle acks for those connections
modified:
  takeover/ctdb_takeover.c       ctdb_takeover.c-20070525071636-a5n1ihghjtppy08r-2
=== modified file 'takeover/ctdb_takeover.c'
--- a/takeover/ctdb_takeover.c	2007-05-27 14:34:40 +0000
+++ b/takeover/ctdb_takeover.c	2007-05-27 14:51:10 +0000
@@ -68,7 +68,7 @@
 	}
 
 	for (tcp=arp->tcp_list;tcp;tcp=tcp->next) {
-		DEBUG(0,("sending tcp tickle ack for %u->%s:%u\\n",
+		DEBUG(2,("sending tcp tickle ack for %u->%s:%u\\n",
 			 (unsigned)ntohs(tcp->daddr.sin_port), 
 			 inet_ntoa(tcp->saddr.sin_addr),
 			 (unsigned)ntohs(tcp->saddr.sin_port)));
@@ -152,6 +152,7 @@
 	TDB_DATA data;
 	char *ip = inet_ntoa(sin->sin_addr);
 	int ret;
+	struct ctdb_tcp_list *tcp;
 
 	if (!ctdb_sys_have_ip(ip)) {
 		return 0;
@@ -178,6 +179,26 @@
 
 	ctdb_daemon_send_message(ctdb, ctdb->vnn, CTDB_SRVID_RELEASE_IP, data);
 
+	/* tell other nodes about any tcp connections we were holding with this IP */
+	for (tcp=ctdb->tcp_list;tcp;tcp=tcp->next) {
+		if (tcp->vnn == ctdb->vnn && 
+		    sin->sin_addr.s_addr == tcp->daddr.sin_addr.s_addr) {
+			struct ctdb_control_tcp_vnn t;
+
+			t.vnn  = ctdb->vnn;
+			t.src  = tcp->saddr;
+			t.dest = tcp->daddr;
+
+			data.dptr = (uint8_t *)&t
+			data.dsize = sizeof(t);
+
+			ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNNMAP, 0, 
+						 CTDB_CONTROL_TCP_ADD,
+						 0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL);
+		}
+	}
+
+
 	return 0;
 }
 

