MEDIUM: backend: always release any existing prior connection in connect_server()

When entering connect_server() we're not supposed to have a connection
already, except when retrying a failed connection, which is pretty rare.
Let's simplify the code by starting to unconditionally release any existing
connection. For now we don't go further, as this change alone will lead to
quite some simplification that'd rather be done as a separate cleanup.
This commit is contained in:
Willy Tarreau 2019-07-18 18:40:06 +02:00
parent 5a0b25d31c
commit a5797aab11

View File

@ -1151,11 +1151,11 @@ int connect_server(struct stream *s)
int err;
/* Some, such as http_proxy and the LUA, create their connection and
* conn_stream manually, so if we already have a conn_stream, try
* to use it.
/* This will catch some corner cases such as lying connections resulting from
* retries or connect timeouts but will rarely trigger.
*/
srv_cs = objt_cs(s->si[1].end);
si_release_endpoint(&s->si[1]);
if (!srv_cs)
srv_conn = objt_conn(s->si[1].end);
else