Author: mturk
Date: Sun Oct 19 04:09:40 2008
New Revision: 705977
URL: http://svn.apache.org/viewvc?rev=705977&view=rev
Log:
EAGAIN is signaled when socket_timeout is set. When timeout occurs during read
we break on Windows because there are no EAGAIN there. So break on posix as well
Modified:
tomcat/connectors/trunk/jk/native/common/jk_connect.c
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=705977&r1=705976&r2=705977&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_connect.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_connect.c Sun Oct 19 04:09:40
2008
@@ -661,6 +661,7 @@
{
char dummy[512];
int rc = 0;
+ int rd = 0;
int save_errno;
fd_set rs;
struct timeval tv;
@@ -674,11 +675,16 @@
}
save_errno = errno;
+ if (JK_IS_DEBUG_LEVEL(l))
+ jk_log(l, JK_LOG_DEBUG, "About to shutdown socket %d", sd);
+
/* Shut down the socket for write, which will send a FIN
* to the peer.
*/
if (shutdown(sd, SHUT_WR)) {
rc = jk_close_socket(sd, l);
+ if (JK_IS_DEBUG_LEVEL(l))
+ jk_log(l, JK_LOG_DEBUG, "Failed sending SHUT_WR for socket %d",
sd);
errno = save_errno;
JK_TRACE_EXIT(l);
return rc;
@@ -707,6 +713,8 @@
#else
rc = read(sd, &dummy[0], sizeof(dummy));
#endif
+ if (rc > 0)
+ rd += rc;
} while (JK_IS_SOCKET_ERROR(rc) && (errno == EINTR || errno ==
EAGAIN));
if (rc <= 0)
@@ -718,6 +726,9 @@
} while (difftime(time(NULL), start) < MAX_SECS_TO_LINGER);
rc = jk_close_socket(sd, l);
+ if (JK_IS_DEBUG_LEVEL(l))
+ jk_log(l, JK_LOG_DEBUG, "Shutdown socket %d and read %d lingering
bytes",
+ sd, rd);
errno = save_errno;
JK_TRACE_EXIT(l);
return rc;
@@ -804,7 +815,7 @@
#else
rd = read(sd, (char *)b + rdlen, len - rdlen);
#endif
- } while (JK_IS_SOCKET_ERROR(rd) && (errno == EINTR || errno ==
EAGAIN));
+ } while (JK_IS_SOCKET_ERROR(rd) && errno == EINTR);
if (JK_IS_SOCKET_ERROR(rd)) {
jk_shutdown_socket(sd, l);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]