aboutsummaryrefslogtreecommitdiff
path: root/src/usocket.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/usocket.c')
-rw-r--r--src/usocket.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/usocket.c b/src/usocket.c
index dcb40e6..f067fa1 100644
--- a/src/usocket.c
+++ b/src/usocket.c
@@ -169,15 +169,8 @@ int sock_connect(p_sock ps, SA *addr, socklen_t len, p_tm tm) {
169 /* zero timeout case optimization */ 169 /* zero timeout case optimization */
170 if (tm_iszero(tm)) return IO_TIMEOUT; 170 if (tm_iszero(tm)) return IO_TIMEOUT;
171 /* wait until we have the result of the connection attempt or timeout */ 171 /* wait until we have the result of the connection attempt or timeout */
172 return sock_connected(ps, tm); 172 err = sock_waitfd(ps, WAITFD_C, tm);
173} 173 if (err == IO_CLOSED) {
174
175/*-------------------------------------------------------------------------*\
176* Checks if socket is connected, or return reason for failure
177\*-------------------------------------------------------------------------*/
178int sock_connected(p_sock ps, p_tm tm) {
179 int err;
180 if ((err = sock_waitfd(ps, WAITFD_C, tm) == IO_CLOSED)) {
181 if (recv(*ps, (char *) &err, 0, 0) == 0) return IO_DONE; 174 if (recv(*ps, (char *) &err, 0, 0) == 0) return IO_DONE;
182 else return errno; 175 else return errno;
183 } else return err; 176 } else return err;