Commit c3f0d438 authored by Karl Heyes's avatar Karl Heyes

handle error condition at connection

svn path=/trunk/net/; revision=5833
parent 2accfe55
...@@ -448,11 +448,12 @@ int sock_read_line(sock_t sock, char *buff, const int len) ...@@ -448,11 +448,12 @@ int sock_read_line(sock_t sock, char *buff, const int len)
} }
} }
/* see if a connection can be written to /* see if a connection has been established
** return -1 for failure * return SOCK_TIMEOUT for timeout
** return 0 for not yet * return SOCK_ERROR for failure
** return 1 for ok * return 0 for try again, interrupted
*/ * return 1 for ok
*/
int sock_connected (int sock, unsigned timeout) int sock_connected (int sock, unsigned timeout)
{ {
fd_set wfds; fd_set wfds;
...@@ -480,7 +481,9 @@ int sock_connected (int sock, unsigned timeout) ...@@ -480,7 +481,9 @@ int sock_connected (int sock, unsigned timeout)
{ {
if (val == 0) if (val == 0)
return 1; return 1;
sock_set_error (val);
} }
/* fall through */
case -1: case -1:
if (sock_recoverable (sock_error())) if (sock_recoverable (sock_error()))
return 0; return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment