diff --git a/ixwebsocket/IXSocketConnect.cpp b/ixwebsocket/IXSocketConnect.cpp index c2d7efca..e8a37ca1 100644 --- a/ixwebsocket/IXSocketConnect.cpp +++ b/ixwebsocket/IXSocketConnect.cpp @@ -76,12 +76,17 @@ namespace ix // block us for too long SocketConnect::configure(fd); - if (::connect(fd, address->ai_addr, address->ai_addrlen) == -1 - && errno != EINPROGRESS) + if (::connect(fd, address->ai_addr, address->ai_addrlen) == -1) { - closeSocket(fd); - errMsg = strerror(errno); - return -1; +#ifdef _WIN32 + if (Socket::getErrno() == EWOULDBLOCK) errno = EINPROGRESS; +#endif + if (errno != EINPROGRESS) + { + closeSocket(fd); + errMsg = strerror(errno); + return -1; + } } for (;;) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a96787c7..9f14aad8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -21,9 +21,11 @@ include_directories( # Shared sources set (SOURCES test_runner.cpp - IXDNSLookupTest.cpp IXTest.cpp msgpack11.cpp + + IXDNSLookupTest.cpp + IXSocketTest.cpp ) # Some unittest don't work on windows yet @@ -31,7 +33,6 @@ if (NOT WIN32) list(APPEND SOURCES IXWebSocketServerTest.cpp cmd_websocket_chat.cpp - IXSocketTest.cpp ) endif()