From c65c95bf203ecd80923b5581f97db980d08ab807 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Mon, 25 Mar 2013 12:47:10 +0100 Subject: Enable TCP keep-alive 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! -- cgit v0.10.2