MINOR: raw_sock: always report asynchronous connection errors

Depending on the pollers used, a connection error may be notified
with POLLOUT|POLLERR|POLLHUP. POLLHUP by itself is enough for the
connection handler to call the read actor, which would only consider
this flag as a good indication of a hangup, without considering the
POLLERR flag.

In order to address this, we directly jump to the read0 label if
POLLERR was not set.

This will be important with health checks as we don't want to believe
a connection was properly established when it's not the case !
This commit is contained in:
Willy Tarreau 2012-10-04 20:17:13 +02:00
parent 8c89c2059f
commit c0e98868fe

View File

@ -70,7 +70,7 @@ int raw_sock_to_pipe(struct connection *conn, struct pipe *pipe, unsigned int co
* Since older splice() implementations were buggy and returned
* EAGAIN on end of read, let's bypass the call to splice() now.
*/
if ((fdtab[conn->t.sock.fd].ev & (FD_POLL_IN|FD_POLL_HUP)) == FD_POLL_HUP)
if ((fdtab[conn->t.sock.fd].ev & (FD_POLL_IN|FD_POLL_ERR|FD_POLL_HUP)) == FD_POLL_HUP)
goto out_read0;
while (count) {
@ -202,7 +202,7 @@ static int raw_sock_to_buf(struct connection *conn, struct buffer *buf, int coun
int try = count;
/* stop here if we reached the end of data */
if ((fdtab[conn->t.sock.fd].ev & (FD_POLL_IN|FD_POLL_HUP)) == FD_POLL_HUP)
if ((fdtab[conn->t.sock.fd].ev & (FD_POLL_IN|FD_POLL_ERR|FD_POLL_HUP)) == FD_POLL_HUP)
goto read0;
/* compute the maximum block size we can read at once. */