]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: checks: check the conn_stream's readiness and not the connection
authorWilly Tarreau <w@1wt.eu>
Tue, 3 Apr 2018 17:31:38 +0000 (19:31 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 3 Apr 2018 17:31:38 +0000 (19:31 +0200)
Since commit 9aaf778 ("MAJOR: connection : Split struct connection into
struct connection and struct conn_stream."), the checks use a conn_stream
and not directly the connection anymore. However wake_srv_chk() still used
to verify the connection's readiness instead of the conn_stream's. Due to
the existence of a mux, the connection is always waiting for receiving
something, and doesn't reflect the changes made in event_srv_chk_{r,w}(),
causing the connection appear as not ready yet, and the check to be
validated only after its timeout. The difference is only visible when
sending pure TCP checks, and simply adding a "tcp-check connect" line
is enough to work around it.

This fix must be backported to 1.8.

src/checks.c

index cae2e3e3fa729a4adc74644436a27aeea213634a..8e4bc2ccf142ade5a9fe4136d2556de957c64f3d 100644 (file)
@@ -1394,7 +1394,7 @@ static int wake_srv_chk(struct conn_stream *cs)
                __cs_stop_both(cs);
                task_wakeup(check->task, TASK_WOKEN_IO);
        }
-       else if (!(conn->flags & (CO_FL_XPRT_RD_ENA|CO_FL_XPRT_WR_ENA|CO_FL_HANDSHAKE))) {
+       else if (!(conn->flags & CO_FL_HANDSHAKE) && !(cs->flags & (CS_FL_DATA_RD_ENA|CS_FL_DATA_WR_ENA))) {
                /* we may get here if only a connection probe was required : we
                 * don't have any data to send nor anything expected in response,
                 * so the completion of the connection establishment is enough.