Commit f8a8b362 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Make VTCP_Check() accept EAGAIN/EWOULDBLOCK as acceptable errno

When a socket timeout is set on a socket and the timeout expires, read()
and write() calls on that socket will return (-1) with errno set to
EAGAIN/EWOULDBLOCK.
parent 0954500d
......@@ -564,6 +564,14 @@ VTCP_Check(int a)
return (1);
if (errno == ECONNRESET || errno == ENOTCONN || errno == EPIPE)
return (1);
/* Accept EAGAIN (and EWOULDBLOCK in case they are not the same)
* as errno values. Even though our sockets are all non-blocking,
* when a SO_{SND|RCV}TIMEO expires, read() or write() on the
* socket will return (-1) and errno set to EAGAIN. (This is not
* documented in the read(2) and write(2) manpages, but is
* described in the socket(7) manpage.) */
if (errno == EAGAIN || errno == EWOULDBLOCK)
return (1);
#if (defined (__SVR4) && defined (__sun))
if (errno == EPROTO)
return (1);
......
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