BUG/MINOR: backend: do not try to install a mux when the connection failed

If si_connect() failed, do not try to install the mux nor to complete
the operations or add the connection to an idle list, and abort quickly
instead. No obvious side effects were identified, but continuing to
allocate some resources after something has already failed seems risky.

This was a result of a prior fix which already wanted to push this code
further : aa089d80b ("BUG/MEDIUM: server: Defer the mux init until after
xprt has been initialized.") but it ought to have pushed it even further
to maintain the error check just after si_connect().

To be backported to 2.0 and 1.9.
This commit is contained in:
Willy Tarreau 2019-07-18 16:18:20 +02:00
parent 69564b1c49
commit 09e0203ef4

View File

@ -1573,6 +1573,9 @@ int connect_server(struct stream *s)
}
err = si_connect(&s->si[1], srv_conn);
if (err != SF_ERR_NONE)
return err;
/* We have to defer the mux initialization until after si_connect()
* has been called, as we need the xprt to have been properly
* initialized, or any attempt to recv during the mux init may
@ -1619,9 +1622,6 @@ int connect_server(struct stream *s)
srv_conn->flags &= ~(CO_FL_SSL_WAIT_HS | CO_FL_WAIT_L6_CONN);
#endif
if (err != SF_ERR_NONE)
return err;
/* set connect timeout */
s->si[1].exp = tick_add_ifset(now_ms, s->be->timeout.connect);