[sheepdog] [PATCH] net: don't use keepalive for sockfd

Liu Yuan namei.unix at gmail.com
Sun Jan 13 16:00:18 CET 2013


From: Liu Yuan <tailai.ly at taobao.com>

Since we already use timeout for IO requests, there is no need to use keepalive
to detect weather the target node is alive or not. For a busy network,
keepalive will false report the connection is broken.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 lib/net.c       |    6 ------
 sheep/request.c |    6 ------
 2 files changed, 12 deletions(-)

diff --git a/lib/net.c b/lib/net.c
index 9b7fea8..343de0f 100644
--- a/lib/net.c
+++ b/lib/net.c
@@ -246,12 +246,6 @@ int connect_to(const char *name, int port)
 			continue;
 		}
 
-		ret = set_keepalive(fd);
-		if (ret) {
-			close(fd);
-			break;
-		}
-
 		ret = set_nodelay(fd);
 		if (ret) {
 			eprintf("%m\n");
diff --git a/sheep/request.c b/sheep/request.c
index cd81e36..4ade726 100644
--- a/sheep/request.c
+++ b/sheep/request.c
@@ -846,12 +846,6 @@ static void listen_handler(int listen_fd, int events, void *data)
 	}
 
 	if (is_inet_socket) {
-		ret = set_keepalive(fd);
-		if (ret) {
-			close(fd);
-			return;
-		}
-
 		ret = set_nodelay(fd);
 		if (ret) {
 			close(fd);
-- 
1.7.9.5




More information about the sheepdog mailing list