Corrected connect in windows. Wasn't setting errno...

This commit is contained in:
Diego Nehab 2004-01-21 01:28:32 +00:00
parent 3a7ac1e043
commit 68d57dc931
2 changed files with 9 additions and 3 deletions

View File

@ -87,8 +87,14 @@ int sock_connect(p_sock ps, SA *addr, socklen_t addr_len, int timeout)
/* if select returned due to an event */
if (err > 0 ) {
/* the sets tell whether it was a sucess or failure */
if (FD_ISSET(sock,&efds) || !FD_ISSET(sock,&wfds)) return IO_ERROR;
else return IO_DONE;
if (FD_ISSET(sock,&efds) || !FD_ISSET(sock,&wfds)) {
int why;
int len = sizeof(why);
/* find out why it failed */
getsockopt(sock, SOL_SOCKET, SO_ERROR, (char *)&why, &len);
WSASetLastError(why);
return IO_ERROR;
} else return IO_DONE;
/* if nothing happened, we timed out */
} else if (err == 0) return IO_TIMEOUT;
/* otherwise, I don't know what happened */

View File

@ -4,7 +4,7 @@ local qptest = "qptest.bin"
local eqptest = "qptest.bin2"
local dqptest = "qptest.bin3"
local b64test = "luasocket"
local b64test = "luasocket.exe"
local eb64test = "b64test.bin"
local db64test = "b64test.bin2"