]> granicus.if.org Git - apache/commitdiff
Lots o bugs and emits here. accept_socket is a handle, although vc and
authorWilliam A. Rowe Jr <wrowe@apache.org>
Sun, 4 Aug 2002 18:44:52 +0000 (18:44 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Sun, 4 Aug 2002 18:44:52 +0000 (18:44 +0000)
  the psdk aren't good about remembering that.  never use GetLastError()
  to ap_log_error.  remember that we could have a socket closed by our
  neighbor while we were blocking.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96307 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/winnt/child.c

index 773d7b49d19934b788d2c1dbdbd90b22ace25ead..6d343d74c359722c61cf53c24c83c4bfe564788a 100644 (file)
@@ -543,11 +543,16 @@ static void winnt_accept(void *lr_)
             while (1) {
                 rv = WaitForSingleObject(context->Overlapped.hEvent, 1000);
                 if (rv == WAIT_OBJECT_0) {
-                    if (!GetOverlappedResult(context->accept_socket, 
+                    if (context->accept_socket == -1) {
+                        /* socket already closed */
+                        break;
+                    }
+                    if (!GetOverlappedResult((HANDLE)context->accept_socket, 
                                              &context->Overlapped, 
                                              &BytesRead, FALSE)) {
-                        ap_log_error(APLOG_MARK,APLOG_WARNING, GetLastError(), ap_server_conf,
-                                     "winnt_accept: Asynchronous AcceptEx failed.");
+                        ap_log_error(APLOG_MARK, APLOG_WARNING, 
+                                     apr_get_os_error(), ap_server_conf,
+                             "winnt_accept: Asynchronous AcceptEx failed.");
                         closesocket(context->accept_socket);
                         context->accept_socket = INVALID_SOCKET;
                     }