aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wsocket.c10
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 */