From 4133fb4341bf5376c612af019831ae79427b7c7a Mon Sep 17 00:00:00 2001 From: Bruno Jesus <00cpxxx@gmail.com> Date: Tue, 30 Jul 2013 09:58:38 -0300 Subject: [PATCH] ws2_32/tests: Add SO_ACCEPTCONN tests. --- dlls/ws2_32/tests/sock.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index fce0b993ed2..1a75ffd947c 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -2460,7 +2460,7 @@ static void test_errors(void) static void test_listen(void) { SOCKET fdA, fdB; - int ret; + int ret, acceptc, olen = sizeof(acceptc); struct sockaddr_in address; memset(&address, 0, sizeof(address)); @@ -2507,9 +2507,17 @@ static void test_listen(void) ok (bind(fdB, (struct sockaddr*) &address, sizeof(address)), "bind should have failed\n"); ok (ret == WSAEINVAL, "expected 10022, received %d\n", ret); + acceptc = 0xdead; + ok (!getsockopt(fdA, SOL_SOCKET, SO_ACCEPTCONN, (char*)&acceptc, &olen), "getsockopt failed\n"); + ok (acceptc == 0, "SO_ACCEPTCONN should be 0, received %d\n", acceptc); + ok (!listen(fdA, 0), "listen failed\n"); ok (!listen(fdA, SOMAXCONN), "double listen failed\n"); + acceptc = 0xdead; + ok (!getsockopt(fdA, SOL_SOCKET, SO_ACCEPTCONN, (char*)&acceptc, &olen), "getsockopt failed\n"); + ok (acceptc == 1, "SO_ACCEPTCONN should be 1, received %d\n", acceptc); + SetLastError(0xdeadbeef); ok ((listen(fdB, SOMAXCONN) == SOCKET_ERROR), "listen did not fail\n"); ret = WSAGetLastError(); @@ -2521,7 +2529,6 @@ static void test_listen(void) fdB = socket(AF_INET, SOCK_STREAM, 0); ok ((fdB != INVALID_SOCKET), "socket failed unexpectedly: %d\n", WSAGetLastError() ); - SetLastError(0xdeadbeef); ok (bind(fdB, (struct sockaddr*) &address, sizeof(address)), "bind should have failed\n"); ret = WSAGetLastError();