Mercurial > hg > nginx
diff src/event/ngx_event_connectex.c @ 187:5a9bbe99008b
nginx-0.0.1-2003-11-17-19:15:03 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 17 Nov 2003 16:15:03 +0000 |
parents | c1f3a3c7c5db |
children | da8c5707af39 |
line wrap: on
line diff
--- a/src/event/ngx_event_connectex.c Sun Nov 16 21:49:42 2003 +0000 +++ b/src/event/ngx_event_connectex.c Mon Nov 17 16:15:03 2003 +0000 @@ -14,8 +14,8 @@ static HANDLE pending_connect_event; __declspec(thread) int nevents = 0; -__declspec(thread) WSAEVENT events[WSA_MAXIMUM_WAIT_EVENTS]; -__declspec(thread) ngx_connection_t *conn[WSA_MAXIMUM_WAIT_EVENTS]; +__declspec(thread) WSAEVENT events[WSA_MAXIMUM_WAIT_EVENTS + 1]; +__declspec(thread) ngx_connection_t *conn[WSA_MAXIMUM_WAIT_EVENTS + 1]; @@ -121,7 +121,7 @@ conn[0] = NULL; for ( ;; ) { - offset = (nevents == WSA_MAXIMUM_WAIT_EVENTS) ? 1: 0; + offset = (nevents == WSA_MAXIMUM_WAIT_EVENTS + 1) ? 1: 0; timeout = (nevents == 1 && !first) ? 60000: INFINITE; n = WSAWaitForMultipleEvents(nevents - offset, events[offset], @@ -133,7 +133,7 @@ } if (n == WAIT_TIMEOUT) { - if (nevents == 1 && !main) { + if (nevents == 2 && !main) { ExitThread(0); } @@ -145,9 +145,9 @@ n -= WSA_WAIT_EVENT_0; - if (n == 0) { + if (events[n] == NULL) { - /* the first event is pending_connect_event */ + /* the pending_connect_event */ if (nevents == WSA_MAXIMUM_WAIT_EVENTS) { ngx_iocp_new_thread(0);