MINOR: stream-int: only use si_release_endpoint() to release a connection

Change si_alloc_conn() to call si_release_endpoint() instead of
open-coding the connection releasing code when reuse is disabled.
This fuses the code with the one already dealing with applets, makes
it shorter and helps centralizing the connection freeing logic at a
single place.
This commit is contained in:
Willy Tarreau 2015-07-19 19:14:10 +02:00
parent 7a08d3b2d7
commit d7c7475ad6

View File

@ -282,19 +282,14 @@ static inline struct connection *si_alloc_conn(struct stream_interface *si, int
{
struct connection *conn;
/* If we find a connection, we return it, otherwise it's an applet
* and we start by releasing it.
/* If we find a reusable connection, we return it, otherwise we start
* by releasing what we have (non-reusable conn or applet).
*/
if (si->end) {
conn = objt_conn(si->end);
if (conn) {
if (!reuse) {
conn_force_close(conn);
conn_init(conn);
}
if (conn && reuse)
return conn;
}
/* it was an applet then */
si_release_endpoint(si);
}