summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2008-11-09 00:44:40 +0000
committerDenis Vlasenko2008-11-09 00:44:40 +0000
commit6d0443557c96dc130d96931007b4d82a2d97bafc (patch)
tree43f16248b9c1770cf012538b60f987d0aef52df3
parent3fa36e235021af5810333a52876d29efc661ad60 (diff)
downloadbusybox-6d0443557c96dc130d96931007b4d82a2d97bafc.zip
busybox-6d0443557c96dc130d96931007b4d82a2d97bafc.tar.gz
telnetd: set SO_KEEPALIVE, users report it's useful. +20 bytes.
-rw-r--r--networking/telnetd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/networking/telnetd.c b/networking/telnetd.c
index f60c420..46dfb31 100644
--- a/networking/telnetd.c
+++ b/networking/telnetd.c
@@ -182,6 +182,8 @@ make_new_session(
ndelay_on(fd);
#if ENABLE_FEATURE_TELNETD_STANDALONE
ts->sockfd_read = sock;
+ /* SO_KEEPALIVE by popular demand */
+ setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, &const_int_1, sizeof(const_int_1));
ndelay_on(sock);
if (!sock) { /* We are called with fd 0 - we are in inetd mode */
sock++; /* so use fd 1 for output */
@@ -191,6 +193,8 @@ make_new_session(
if (sock > maxfd)
maxfd = sock;
#else
+ /* SO_KEEPALIVE by popular demand */
+ setsockopt(0, SOL_SOCKET, SO_KEEPALIVE, &const_int_1, sizeof(const_int_1));
/* ts->sockfd_read = 0; - done by xzalloc */
ts->sockfd_write = 1;
ndelay_on(0);