Mike Kaplinskiy : ws2_32/tests: Test connecting a pending accept socket.

Alexandre Julliard julliard at winehq.org
Thu Aug 20 12:58:57 CDT 2009


Module: wine
Branch: master
Commit: 9b906c6766f17c1581ef0ba04f563664cf3f1877
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9b906c6766f17c1581ef0ba04f563664cf3f1877

Author: Mike Kaplinskiy <mike.kaplinskiy at gmail.com>
Date:   Wed Aug 19 14:22:15 2009 -0400

ws2_32/tests: Test connecting a pending accept socket.

---

 dlls/ws2_32/tests/sock.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 7aa727a..e16fe21 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -2849,6 +2849,28 @@ static void test_AcceptEx(void)
         ok(bret == FALSE && WSAGetLastError() == ERROR_IO_PENDING, "AcceptEx returned %d + errno %d\n", bret, WSAGetLastError());
     }
 
+    iret = connect(acceptor,  (struct sockaddr*)&bindAddress, sizeof(bindAddress));
+    ok(iret == SOCKET_ERROR && WSAGetLastError() == WSAEINVAL,
+       "connecting to acceptex acceptor succeeded? return %d + errno %d\n", iret, WSAGetLastError());
+    if (!iret || (iret == SOCKET_ERROR && WSAGetLastError() == WSAEWOULDBLOCK)) {
+        /* We need to cancel this call, otherwise things fail */
+        closesocket(acceptor);
+        acceptor = socket(AF_INET, SOCK_STREAM, 0);
+        if (acceptor == INVALID_SOCKET) {
+            skip("could not create acceptor socket, error %d\n", WSAGetLastError());
+            goto end;
+        }
+
+        bret = CancelIo((HANDLE) listener);
+        ok(bret, "Failed to cancel failed test. Bailing...\n");
+        if (!bret) return;
+
+        bret = pAcceptEx(listener, acceptor, buffer, 0,
+            sizeof(struct sockaddr_in) + 16, sizeof(struct sockaddr_in) + 16,
+            &bytesReturned, &overlapped);
+        ok(bret == FALSE && WSAGetLastError() == ERROR_IO_PENDING, "AcceptEx returned %d + errno %d\n", bret, WSAGetLastError());
+    }
+
     iret = connect(connector, (struct sockaddr*)&bindAddress, sizeof(bindAddress));
     ok(iret == 0, "connecting to accepting socket failed, error %d\n", WSAGetLastError());
 




More information about the wine-cvs mailing list