windows connect (compile fix)
This commit is contained in:
parent
b57c1d69f2
commit
bf6f057777
@ -116,27 +116,20 @@ namespace ix
|
|||||||
// Nothing was written to the socket, wait again.
|
// Nothing was written to the socket, wait again.
|
||||||
if (!FD_ISSET(fd, &wfds)) continue;
|
if (!FD_ISSET(fd, &wfds)) continue;
|
||||||
|
|
||||||
// Something was written to the socket
|
// Something was written to the socket. Check for errors.
|
||||||
#ifdef _WIN32
|
|
||||||
if (FD_ISSET(fd, &efds))
|
|
||||||
{
|
|
||||||
closeSocket(fd);
|
|
||||||
errMsg = std::string("Connect error in getsockopt:") + strerror(optval);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Success !
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
int optval = -1;
|
int optval = -1;
|
||||||
socklen_t optlen = sizeof(optval);
|
socklen_t optlen = sizeof(optval);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
//
|
||||||
|
if (FD_ISSET(fd, &efds))
|
||||||
|
#else
|
||||||
// getsockopt() puts the errno value for connect into optval so 0
|
// getsockopt() puts the errno value for connect into optval so 0
|
||||||
// means no-error.
|
// means no-error.
|
||||||
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &optval, &optlen) == -1 ||
|
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &optval, &optlen) == -1 ||
|
||||||
optval != 0)
|
optval != 0)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
closeSocket(fd);
|
closeSocket(fd);
|
||||||
errMsg = std::string("Connect error in getsockopt:") + strerror(optval);
|
errMsg = std::string("Connect error in getsockopt:") + strerror(optval);
|
||||||
@ -147,7 +140,6 @@ namespace ix
|
|||||||
// Success !
|
// Success !
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSocket(fd);
|
closeSocket(fd);
|
||||||
|
Loading…
Reference in New Issue
Block a user