X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/01fe3d80cb9ebc8eefa8003cc852ec469fd87b24..79bf227ba7ba02e32ac710621b672e2789f9ef50:/unix/uxnet.c diff --git a/unix/uxnet.c b/unix/uxnet.c index 1e7d51b7..08fb4e17 100644 --- a/unix/uxnet.c +++ b/unix/uxnet.c @@ -378,7 +378,7 @@ Socket sk_register(OSSocket sockfd, Plug plug) } Socket sk_new(SockAddr addr, int port, int privport, int oobinline, - int nodelay, Plug plug) + int nodelay, int keepalive, Plug plug) { int s; #ifdef IPV6 @@ -433,6 +433,11 @@ Socket sk_new(SockAddr addr, int port, int privport, int oobinline, setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (void *) &b, sizeof(b)); } + if (keepalive) { + int b = TRUE; + setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (void *) &b, sizeof(b)); + } + /* * Bind to local address. */