MINOR: connection: do not check for CO_FL_SOCK_RD_SH too early

The handshake functions dedicated to proxy proto, netscaler and
socks4 all check for this flag before proceeding. This is wrong,
they must not do and instead perform the call to recv() then
report the close. The reason for this is that the current
construct managed to lose the CO_ER_CIP_EMPTY error code in case
the connection was already shut, thus causing a race condition
with some errors being reported correctly or as unknown depending
on the timing.
This commit is contained in:
Willy Tarreau 2020-01-23 18:05:18 +01:00
parent 6d015724ec
commit d838fb840c

View File

@ -493,10 +493,6 @@ int conn_recv_proxy(struct connection *conn, int flag)
int tlv_offset = 0;
int ret;
/* we might have been called just after an asynchronous shutr */
if (conn->flags & CO_FL_SOCK_RD_SH)
goto fail;
if (!conn_ctrl_ready(conn))
goto fail;
@ -825,10 +821,6 @@ int conn_recv_netscaler_cip(struct connection *conn, int flag)
uint8_t ip_ver;
int ret;
/* we might have been called just after an asynchronous shutr */
if (conn->flags & CO_FL_SOCK_RD_SH)
goto fail;
if (!conn_ctrl_ready(conn))
goto fail;
@ -1094,10 +1086,6 @@ int conn_recv_socks4_proxy_response(struct connection *conn)
char line[SOCKS4_HS_RSP_LEN];
int ret;
/* we might have been called just after an asynchronous shutr */
if (conn->flags & CO_FL_SOCK_RD_SH)
goto fail;
if (!conn_ctrl_ready(conn))
goto fail;