From: William A. Rowe Jr Date: Sun, 4 Aug 2002 18:44:52 +0000 (+0000) Subject: Lots o bugs and emits here. accept_socket is a handle, although vc and X-Git-Tag: 2.0.40~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c378e63f582bb33b1fd7f2616bebede978114488;p=apache Lots o bugs and emits here. accept_socket is a handle, although vc and 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 --- diff --git a/server/mpm/winnt/child.c b/server/mpm/winnt/child.c index 773d7b49d1..6d343d74c3 100644 --- a/server/mpm/winnt/child.c +++ b/server/mpm/winnt/child.c @@ -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; }