BUG: connection: fix regression from commit 9e272bf9

Commit 9e272bf9 broke connection setup in TCP mode, the comment was
misleading and obviously wrong, as after a connection is established,
we *do* have none of the CONNECT* flags. However we can never have
them all at the same time, so let's use this to trigger a detection.
This commit is contained in:
Willy Tarreau 2012-10-05 21:29:37 +02:00
parent 3c4bc6e10a
commit 3b5bc66554

View File

@ -86,19 +86,19 @@ int conn_fd_handler(int fd)
/* The data transfer starts here and stops on error and handshakes */ /* The data transfer starts here and stops on error and handshakes */
if ((fdtab[fd].ev & (FD_POLL_IN | FD_POLL_HUP | FD_POLL_ERR)) && if ((fdtab[fd].ev & (FD_POLL_IN | FD_POLL_HUP | FD_POLL_ERR)) &&
!(conn->flags & (CO_FL_WAIT_RD|CO_FL_WAIT_ROOM|CO_FL_ERROR|CO_FL_HANDSHAKE))) { !(conn->flags & (CO_FL_WAIT_RD|CO_FL_WAIT_ROOM|CO_FL_ERROR|CO_FL_HANDSHAKE))) {
/* force detection of a flag change : if any I/O succeeds, we're /* force detection of a flag change : it's impossible to have both
* forced to have at least one of the CONN_* flags in conn->flags. * CONNECTED and WAIT_CONN so we're certain to trigger a change.
*/ */
flags = 0; flags = CO_FL_WAIT_L4_CONN | CO_FL_CONNECTED;
conn->data->recv(conn); conn->data->recv(conn);
} }
if ((fdtab[fd].ev & (FD_POLL_OUT | FD_POLL_ERR)) && if ((fdtab[fd].ev & (FD_POLL_OUT | FD_POLL_ERR)) &&
!(conn->flags & (CO_FL_WAIT_WR|CO_FL_WAIT_DATA|CO_FL_ERROR|CO_FL_HANDSHAKE))) { !(conn->flags & (CO_FL_WAIT_WR|CO_FL_WAIT_DATA|CO_FL_ERROR|CO_FL_HANDSHAKE))) {
/* force detection of a flag change : if any I/O succeeds, we're /* force detection of a flag change : it's impossible to have both
* forced to have at least one of the CONN_* flags in conn->flags. * CONNECTED and WAIT_CONN so we're certain to trigger a change.
*/ */
flags = 0; flags = CO_FL_WAIT_L4_CONN | CO_FL_CONNECTED;
conn->data->send(conn); conn->data->send(conn);
} }