Skip to content

Commit

Permalink
fix (2) work with nonblocking socket for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
DeckerSU committed Jun 10, 2018
1 parent 164e763 commit b17a01b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions iguana/exchanges/LP_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b17a01b

Please sign in to comment.