From 89c8259da9ae5e24ca88960aef2267c77c683539 Mon Sep 17 00:00:00 2001 From: "William A. Rowe Jr" Date: Thu, 5 Mar 2009 20:00:03 +0000 Subject: [PATCH] Until APR is actually fixed between apr_os_sock_make and the logic within apr_socket_timeout_set, let's presume that vendor differences of socket stack drivers can vary this behavior, and the assumptions were unsafe for both accept() and AcceptEx(). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@750569 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/winnt/child.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/server/mpm/winnt/child.c b/server/mpm/winnt/child.c index 096f0ae375..a4ac6971a7 100644 --- a/server/mpm/winnt/child.c +++ b/server/mpm/winnt/child.c @@ -615,11 +615,6 @@ reinit: /* target of data or connect upon too many AcceptEx failures */ * os_sock_make and os_sock_put that it does not query). */ WSAEventSelect(context->accept_socket, 0, 0); - ioctlsocket(context->accept_socket, FIONBIO, &zero); - setsockopt(context->accept_socket, SOL_SOCKET, SO_RCVTIMEO, - (char *) &zero, sizeof(zero)); - setsockopt(context->accept_socket, SOL_SOCKET, SO_SNDTIMEO, - (char *) &zero, sizeof(zero)); context->overlapped.Pointer = NULL; err_count = 0; } @@ -629,6 +624,16 @@ reinit: /* target of data or connect upon too many AcceptEx failures */ sockinfo.remote = context->sa_client; sockinfo.family = context->sa_server->sa_family; sockinfo.type = SOCK_STREAM; + /* Restore the state corresponding to apr_os_sock_make's default + * assumption of timeout -1 (really, a flaw of os_sock_make and + * os_sock_put that it does not query to determine ->timeout). + * XXX: Upon a fix to APR, these three statements should disappear. + */ + ioctlsocket(context->accept_socket, FIONBIO, &zero); + setsockopt(context->accept_socket, SOL_SOCKET, SO_RCVTIMEO, + (char *) &zero, sizeof(zero)); + setsockopt(context->accept_socket, SOL_SOCKET, SO_SNDTIMEO, + (char *) &zero, sizeof(zero)); apr_os_sock_make(&context->sock, &sockinfo, context->ptrans); /* When a connection is received, send an io completion notification -- 2.50.1