Rev 307: enable TCP keepalives in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Tue May 15 08:40:57 GMT 2007


------------------------------------------------------------
revno: 307
revision-id: tridge at samba.org-20070515084056-6333fevxsd6cnlzz
parent: tridge at samba.org-20070515051336-gkm61o3ruygf0u9n
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Tue 2007-05-15 18:40:56 +1000
message:
  enable TCP keepalives
modified:
  tcp/tcp_connect.c              tcp_connect.c-20061128004937-x70q1cu5xzg5g2tm-1
=== modified file 'tcp/tcp_connect.c'
--- a/tcp/tcp_connect.c	2007-05-15 04:08:58 +0000
+++ b/tcp/tcp_connect.c	2007-05-15 08:40:56 +0000
@@ -82,6 +82,7 @@
 	talloc_free(fde);
 	
         setsockopt(tnode->fd,IPPROTO_TCP,TCP_NODELAY,(char *)&one,sizeof(one));
+        setsockopt(tnode->fd,SOL_SOCKET,SO_KEEPALIVE,(char *)&one,sizeof(one));
 
 	ctdb_queue_set_fd(tnode->queue, tnode->fd);
 
@@ -180,6 +181,7 @@
 	socklen_t len;
 	int fd;
 	struct ctdb_incoming *in;
+	int one = 1;
 
 	ctdb = talloc_get_type(private_data, struct ctdb_context);
 	ctcp = talloc_get_type(ctdb->private_data, struct ctdb_tcp);
@@ -194,6 +196,8 @@
 
 	set_nonblocking(in->fd);
 
+        setsockopt(in->fd,SOL_SOCKET,SO_KEEPALIVE,(char *)&one,sizeof(one));
+
 	in->queue = ctdb_queue_setup(ctdb, in, in->fd, CTDB_TCP_ALIGNMENT, 
 				     ctdb_tcp_read_cb, in);
 }



More information about the samba-cvs mailing list