From: Olivier Houchard Date: Thu, 29 Nov 2018 16:08:53 +0000 (+0100) Subject: MEDIUM: connections: Put H2 connections in the idle list if http-reuse always. X-Git-Tag: v1.9-dev9~100 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bf024f0a1545f17e93d4b2e7879ece4d002d194e;p=thirdparty%2Fhaproxy.git MEDIUM: connections: Put H2 connections in the idle list if http-reuse always. When creating a new outgoing H2 connection, put it in the idle list so that it's immediately available for others to use, if http-reuse always is used. --- diff --git a/src/backend.c b/src/backend.c index 19157baa67..fa01a7d240 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1045,6 +1045,7 @@ static int conn_complete_server(struct connection *conn) { struct conn_stream *cs = NULL; struct stream *s = conn->mux_ctx; + struct server *srv; task_wakeup(s->task, TASK_WOKEN_IO); conn_clear_xprt_done_cb(conn); @@ -1062,6 +1063,11 @@ static int conn_complete_server(struct connection *conn) goto fail; if (conn_install_mux_be(conn, cs) < 0) goto fail; + srv = objt_server(s->target); + if (srv && ((s->be->options & PR_O_REUSE_MASK) == PR_O_REUSE_ALWS) && + conn->mux->avail_streams(conn) > 0) + LIST_ADD(&srv->idle_conns[tid], &conn->list); + return 0; fail: @@ -1279,6 +1285,13 @@ int connect_server(struct stream *s) } if (conn_install_mux_be(srv_conn, srv_cs) < 0) return SF_ERR_INTERNAL; + /* If we're doing http-reuse always, and the connection + * is an http2 connection, add it to the available list, + * so that others can use it right away. + */ + if (srv && ((s->be->options & PR_O_REUSE_MASK) == PR_O_REUSE_ALWS) && + srv_conn->mux->avail_streams(srv_conn) > 0) + LIST_ADD(&srv->idle_conns[tid], &srv_conn->list); } #if defined(USE_OPENSSL) && defined(TLSEXT_TYPE_application_layer_protocol_negotiation) else {