X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/fc0f17db91f32c7504756e92a411a60d2ef0e264..33f07e9636e80bb17f25f97145ca2e0eb262db30:/winnet.c diff --git a/winnet.c b/winnet.c index 21a2f293..bcb22bf4 100644 --- a/winnet.c +++ b/winnet.c @@ -658,7 +658,7 @@ Socket sk_register(void *sock, Plug plug) } Socket sk_new(SockAddr addr, int port, int privport, int oobinline, - int nodelay, Plug plug) + int nodelay, int keepalive, Plug plug) { static const struct socket_function_table fn_table = { sk_tcp_plug, @@ -722,6 +722,11 @@ Socket sk_new(SockAddr addr, int port, int privport, int oobinline, p_setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (void *) &b, sizeof(b)); } + if (keepalive) { + BOOL b = TRUE; + p_setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (void *) &b, sizeof(b)); + } + /* * Bind to local address. */