aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalev Lember <kalevlember@gmail.com>2013-03-25 11:47:10 (GMT)
committerKalev Lember <kalevlember@gmail.com>2013-03-25 11:47:10 (GMT)
commitc65c95bf203ecd80923b5581f97db980d08ab807 (patch)
tree4575ac860838b9826e6bea2f692966096f078810
parent7bc51bf8476e4546efaf28b90399e8a0280ac71f (diff)
downloadpowwow-c65c95bf203ecd80923b5581f97db980d08ab807.zip
powwow-c65c95bf203ecd80923b5581f97db980d08ab807.tar.gz
powwow-c65c95bf203ecd80923b5581f97db980d08ab807.tar.bz2
Enable TCP keep-alive
-rw-r--r--tcp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tcp.c b/tcp.c
index f4af987..2cca739 100644
--- a/tcp.c
+++ b/tcp.c
@@ -226,6 +226,10 @@ int tcp_connect __P2 (char *,addr, int,port)
if (setsockopt(newtcp_fd, SOL_TCP, TCP_NODELAY, &opt, sizeof(opt)))
errmsg("setsockopt(TCP_NODELAY) failed");
+ /* TCP keep-alive */
+ if (setsockopt(newtcp_fd, SOL_SOCKET, SO_KEEPALIVE, &opt, sizeof(opt)))
+ errmsg("setsockopt(SO_KEEPALIVE) failed");
+
/*
* Then, close-on-exec:
* we don't want children to inherit the socket!