mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-05 03:29:35 +00:00
BUG/MEDIUM: connection: Be sure to always install a mux for sync connect
Sometime, a server connection may be performed synchronously. Most of time on TCP socket, it does not happen. It is easier to have sync connect with unix socket. When it happens, if we are not waiting for any hanshake completion, we must be sure to have a mux installed before leaving the connect_server() function because an attempt to send may be done before the I/O connection handler have a chance to be executed to install the mux, if not already done. For now, It is not expected to perform a send with no mux installed, leading to a crash if it happens. This patch should fix the issue #762 and probably #779 too. It must be backported as far as 1.9.
This commit is contained in:
parent
8f587ea347
commit
3f5bcd0c96
@ -1581,6 +1581,14 @@ int connect_server(struct stream *s)
|
||||
if ((srv_cs->flags & CS_FL_EOI) && !(si_ic(&s->si[1])->flags & CF_EOI))
|
||||
si_ic(&s->si[1])->flags |= (CF_EOI|CF_READ_PARTIAL);
|
||||
|
||||
/* catch all sync connect while the mux is not already installed */
|
||||
if (!srv_conn->mux && !(srv_conn->flags & CO_FL_WAIT_XPRT)) {
|
||||
if (conn_create_mux(srv_conn) < 0) {
|
||||
conn_full_close(srv_conn);
|
||||
return SF_ERR_INTERNAL;
|
||||
}
|
||||
}
|
||||
|
||||
return SF_ERR_NONE; /* connection is OK */
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user