]> granicus.if.org Git - apache/commitdiff
Win32: plug a socket handle leak on Win9x and when using Win32DisableAcceptex on NT
authorBill Stoddard <stoddard@apache.org>
Fri, 9 Jan 2004 02:22:45 +0000 (02:22 +0000)
committerBill Stoddard <stoddard@apache.org>
Fri, 9 Jan 2004 02:22:45 +0000 (02:22 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102238 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/winnt/child.c

index 7f6e556c88cc660b9691665f020ca712c91c8327..5b0aaa181ada6e27fca9655b3e08de227231a933 100644 (file)
@@ -767,6 +767,16 @@ static void worker_main(long thread_num)
                 context->accept_socket = INVALID_SOCKET;
                 ap_lingering_close(c);
             }
+            else if (!use_acceptex) {
+                /* If the socket is disconnected but we are not using acceptex, 
+                 * we cannot reuse the socket. Disconnected sockets are removed
+                 * from the apr_socket_t struct by apr_sendfile() to prevent the
+                 * socket descriptor from being inadvertently closed by a call 
+                 * to apr_socket_close(), so close it directly.
+                 */
+                closesocket(context->accept_socket);
+                context->accept_socket = INVALID_SOCKET;
+            }
         }
         else {
             /* ap_run_create_connection closes the socket on failure */