From: Willy Tarreau Date: Sun, 19 Jul 2015 17:14:10 +0000 (+0200) Subject: MINOR: stream-int: only use si_release_endpoint() to release a connection X-Git-Tag: v1.6-dev3~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d7c7475ad63a30d5c982f8725984f0d31775c77f;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/include/proto/stream_interface.h b/include/proto/stream_interface.h index 0745d85e84..dac4c0a19c 100644 --- a/include/proto/stream_interface.h +++ b/include/proto/stream_interface.h @@ -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); }