From 14d318dfe5f010eca2469a430a36308beb8a1dd0 Mon Sep 17 00:00:00 2001 From: Enrico Giordani Date: Tue, 7 Jul 2015 11:53:46 +0200 Subject: [PATCH] [Fix] aeWinQueueAccept wrong return value. [Change] Variable name acceptsocket changed to acceptfd. --- src/Win32_Interop/win32_wsiocp.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Win32_Interop/win32_wsiocp.c b/src/Win32_Interop/win32_wsiocp.c index f4ea61cd..ee9ed7a8 100644 --- a/src/Win32_Interop/win32_wsiocp.c +++ b/src/Win32_Interop/win32_wsiocp.c @@ -31,7 +31,6 @@ #include #include - static void *iocpState; static HANDLE iocph; static fnGetSockState * aeGetSockState; @@ -94,7 +93,7 @@ int aeWinQueueAccept(int listenfd) { return -1; } - return TRUE; + return 0; } /* listen using extension function to get faster accepts */ @@ -126,7 +125,7 @@ int aeWinListen(int rfd, int backlog) { /* return the queued accept socket */ int aeWinAccept(int fd, struct sockaddr *sa, socklen_t *len) { aeSockState *sockstate; - int acceptsock; + int acceptfd; int result; SOCKADDR *plocalsa; SOCKADDR *premotesa; @@ -139,7 +138,6 @@ int aeWinAccept(int fd, struct sockaddr *sa, socklen_t *len) { return SOCKET_ERROR; } - areq = sockstate->reqs; if (areq == NULL) { errno = EWOULDBLOCK; @@ -148,9 +146,9 @@ int aeWinAccept(int fd, struct sockaddr *sa, socklen_t *len) { sockstate->reqs = areq->next; - acceptsock = (int)areq->accept; + acceptfd = (int)areq->accept; - result = FDAPI_UpdateAcceptContext(acceptsock); + result = FDAPI_UpdateAcceptContext(acceptfd); if (result == SOCKET_ERROR) { errno = WSAGetLastError(); return SOCKET_ERROR; @@ -158,7 +156,7 @@ int aeWinAccept(int fd, struct sockaddr *sa, socklen_t *len) { locallen = *len; FDAPI_GetAcceptExSockaddrs( - acceptsock, + acceptfd, areq->buf, 0, sizeof(struct sockaddr_storage), @@ -170,10 +168,10 @@ int aeWinAccept(int fd, struct sockaddr *sa, socklen_t *len) { memcpy(sa, premotesa, locallen); *len = locallen; - aeWinSocketAttach(acceptsock); + aeWinSocketAttach(acceptfd); // Save remote address to support aeWinGetPeerName() - if ((acceptsockstate = aeGetExistingSockState(iocpState, acceptsock)) == NULL) { + if ((acceptsockstate = aeGetExistingSockState(iocpState, acceptfd)) == NULL) { errno = WSAEINVAL; return SOCKET_ERROR; } @@ -187,7 +185,7 @@ int aeWinAccept(int fd, struct sockaddr *sa, socklen_t *len) { return SOCKET_ERROR; } - return acceptsock; + return acceptfd; } int aeWinGetPeerName(int fd, struct sockaddr *addr, socklen_t * addrlen) {