Author: mturk Date: Sat Oct 11 09:02:37 2008 New Revision: 703677 URL: http://svn.apache.org/viewvc?rev=703677&view=rev Log: Don't use default socket keepalive interval. If timeout set, use ten times its value, if not use 10 minutes for keepalive packets (Windows only)
Modified: tomcat/connectors/trunk/jk/native/common/jk_connect.c tomcat/connectors/trunk/jk/native/common/jk_global.h Modified: tomcat/connectors/trunk/jk/native/common/jk_connect.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_connect.c?rev=703677&r1=703676&r2=703677&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/native/common/jk_connect.c (original) +++ tomcat/connectors/trunk/jk/native/common/jk_connect.c Sat Oct 11 09:02:37 2008 @@ -448,6 +448,29 @@ jk_log(l, JK_LOG_DEBUG, "socket TCP_NODELAY set to On"); if (keepalive) { +#if defined(WIN32) && !defined(NETWARE) + DWORD dw; + struct tcp_keepalive ka = { 0 }, ks = { 0 }; + if (timeout) + ka.keepalivetime = timeout * 10000; + else + ka.keepalivetime = 60 * 10000; /* 10 minutes */ + ka.keepaliveinterval = 1000; + ka.onoff = 1; + if (WSAIoctl(sd, SIO_KEEPALIVE_VALS, &ka, sizeof(ka), + &ks, sizeof(ks), &dw, NULL, NULL)) { + JK_GET_SOCKET_ERRNO(); + jk_log(l, JK_LOG_ERROR, + "failed setting SIO_KEEPALIVE_VALS (errno=%d)", errno); + jk_close_socket(sd, l); + JK_TRACE_EXIT(l); + return JK_INVALID_SOCKET; + } + if (JK_IS_DEBUG_LEVEL(l)) + jk_log(l, JK_LOG_DEBUG, + "socket SO_KEEPALIVE set to %d seconds", + ka.keepalivetime / 1000); +#else set = 1; if (setsockopt(sd, SOL_SOCKET, SO_KEEPALIVE, (SET_TYPE)&set, sizeof(set))) { @@ -461,6 +484,7 @@ if (JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, "socket SO_KEEPALIVE set to On"); +#endif } if (sock_buf > 0) { Modified: tomcat/connectors/trunk/jk/native/common/jk_global.h URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_global.h?rev=703677&r1=703676&r2=703677&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/native/common/jk_global.h (original) +++ tomcat/connectors/trunk/jk/native/common/jk_global.h Sat Oct 11 09:02:37 2008 @@ -117,6 +117,7 @@ #include <winsock2.h> #include <mswsock.h> #include <ws2tcpip.h> +#include <mstcpip.h> #endif /* _WINDOWS_ */ #include <sys/timeb.h> #include <process.h> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]