From b17a01b3849e08ffc212a57e7d7cae67b89d2e77 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Jun 2018 22:23:18 +0300 Subject: [PATCH] fix (2) work with nonblocking socket for Windows --- iguana/exchanges/LP_socket.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_socket.c b/iguana/exchanges/LP_socket.c index e0ae18124..4a1386eb8 100644 --- a/iguana/exchanges/LP_socket.c +++ b/iguana/exchanges/LP_socket.c @@ -62,15 +62,19 @@ int32_t komodo_connect(int32_t sock,struct sockaddr *saddr,socklen_t addrlen) { #ifdef _WIN32 // https://msdn.microsoft.com/en-us/library/windows/desktop/ms737625%28v=vs.85%29.aspx - read about WSAEWOULDBLOCK return - if ( errno != EINPROGRESS && errno != WSAEWOULDBLOCK ) // connect failed, do something... + errno = WSAGetLastError(); + printf("[Decker] errno.%d --> ", errno); + if ( errno != EINPROGRESS && errno != WSAEWOULDBLOCK ) // connect failed, do something... #else if ( errno != EINPROGRESS ) // connect failed, do something... #endif { - closesocket(sock); + printf("close socket ...\n"); + closesocket(sock); return(-1); } - FD_ZERO(&wfd); + printf("continue with select ...\n"); + FD_ZERO(&wfd); FD_SET(sock,&wfd); FD_ZERO(&efd); FD_SET(sock,&efd);