mturk 2005/02/20 00:15:33
Modified: jk/native/common jk_connect.c
Log:
Disable lingering on socket. This way the socket will be hard closed without
waiting for delivery of remaining data.
Revision Changes Path
1.44 +19 -3 jakarta-tomcat-connectors/jk/native/common/jk_connect.c
Index: jk_connect.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_connect.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- jk_connect.c 19 Feb 2005 09:13:35 -0000 1.43
+++ jk_connect.c 20 Feb 2005 08:15:33 -0000 1.44
@@ -126,7 +126,10 @@
char buf[32];
int sock;
int set = 1;
- int ret;
+ int ret = 0;
+#ifdef SO_LINGER
+ struct linger li;
+#endif
JK_TRACE_ENTER(l);
@@ -215,7 +218,7 @@
* systems?
*/
set = 1;
- if (setsockopt(sd, SOL_SOCKET, SO_NOSIGPIPE, (const char *)&set,
+ if (setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, (const char *)&set,
sizeof(int))) {
JK_GET_SOCKET_ERRNO();
jk_log(l, JK_LOG_ERROR,
@@ -225,6 +228,19 @@
return -1;
}
#endif
+#ifdef SO_LINGER
+ /* Make hard closesocket by disabling lingering */
+ li.l_linger = li.l_onoff = 0;
+ if (setsockopt(sock, SOL_SOCKET, SO_LINGER, (const char *)&li,
+ sizeof(li))) {
+ JK_GET_SOCKET_ERRNO();
+ jk_log(l, JK_LOG_ERROR,
+ "failed setting SO_LINGER with errno=%d", errno);
+ jk_close_socket(sock);
+ JK_TRACE_EXIT(l);
+ return -1;
+ }
+#endif
/* Tries to connect to Tomcat (continues trying while error is EINTR) */
do {
if (JK_IS_DEBUG_LEVEL(l))
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]