diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-01-21 01:28:32 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-01-21 01:28:32 +0000 |
commit | 68d57dc931e3567e46fddf08036a3328df8b6d2e (patch) | |
tree | 2c53f58d939c6df453ed93a0f2fb72581090f2dc /src | |
parent | 3a7ac1e04361e12ddfcbf344e9e1db82fb88157b (diff) | |
download | luasocket-68d57dc931e3567e46fddf08036a3328df8b6d2e.tar.gz luasocket-68d57dc931e3567e46fddf08036a3328df8b6d2e.tar.bz2 luasocket-68d57dc931e3567e46fddf08036a3328df8b6d2e.zip |
Corrected connect in windows. Wasn't setting errno...
Diffstat (limited to 'src')
-rw-r--r-- | src/wsocket.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/wsocket.c b/src/wsocket.c index c0e28d9..5ea2e56 100644 --- a/src/wsocket.c +++ b/src/wsocket.c | |||
@@ -87,8 +87,14 @@ int sock_connect(p_sock ps, SA *addr, socklen_t addr_len, int timeout) | |||
87 | /* if select returned due to an event */ | 87 | /* if select returned due to an event */ |
88 | if (err > 0 ) { | 88 | if (err > 0 ) { |
89 | /* the sets tell whether it was a sucess or failure */ | 89 | /* the sets tell whether it was a sucess or failure */ |
90 | if (FD_ISSET(sock,&efds) || !FD_ISSET(sock,&wfds)) return IO_ERROR; | 90 | if (FD_ISSET(sock,&efds) || !FD_ISSET(sock,&wfds)) { |
91 | else return IO_DONE; | 91 | int why; |
92 | int len = sizeof(why); | ||
93 | /* find out why it failed */ | ||
94 | getsockopt(sock, SOL_SOCKET, SO_ERROR, (char *)&why, &len); | ||
95 | WSASetLastError(why); | ||
96 | return IO_ERROR; | ||
97 | } else return IO_DONE; | ||
92 | /* if nothing happened, we timed out */ | 98 | /* if nothing happened, we timed out */ |
93 | } else if (err == 0) return IO_TIMEOUT; | 99 | } else if (err == 0) return IO_TIMEOUT; |
94 | /* otherwise, I don't know what happened */ | 100 | /* otherwise, I don't know what happened */ |