mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-29 17:42:54 +00:00
BUG/MEDIUM: mux-h2: Don't add private connections in available connection list
When a stream is detached from a backend private connection, we must not insert it in the available connection list. In addition, we must be sure to remove it from this list. To ensure it is properly performed, this part has been slightly refactored to clearly split processing of private connections from the others. This patch should probably be backported to 2.2.
This commit is contained in:
parent
e0e6aa5dda
commit
c5579d18d1
20
src/mux_h2.c
20
src/mux_h2.c
@ -3945,7 +3945,8 @@ static void h2_detach(struct conn_stream *cs)
|
|||||||
/* Never ever allow to reuse a connection from a non-reuse backend */
|
/* Never ever allow to reuse a connection from a non-reuse backend */
|
||||||
if ((h2c->proxy->options & PR_O_REUSE_MASK) == PR_O_REUSE_NEVR)
|
if ((h2c->proxy->options & PR_O_REUSE_MASK) == PR_O_REUSE_NEVR)
|
||||||
h2c->conn->flags |= CO_FL_PRIVATE;
|
h2c->conn->flags |= CO_FL_PRIVATE;
|
||||||
if (!h2c->conn->owner && (h2c->conn->flags & CO_FL_PRIVATE)) {
|
if (h2c->conn->flags & CO_FL_PRIVATE) {
|
||||||
|
if (!h2c->conn->owner) {
|
||||||
h2c->conn->owner = sess;
|
h2c->conn->owner = sess;
|
||||||
if (!session_add_conn(sess, h2c->conn, h2c->conn->target)) {
|
if (!session_add_conn(sess, h2c->conn, h2c->conn->target)) {
|
||||||
h2c->conn->owner = NULL;
|
h2c->conn->owner = NULL;
|
||||||
@ -3956,14 +3957,20 @@ static void h2_detach(struct conn_stream *cs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (eb_is_empty(&h2c->streams_by_id)) {
|
if (eb_is_empty(&h2c->streams_by_id) && h2c->conn->owner == sess) {
|
||||||
if (sess && h2c->conn->owner == sess &&
|
if (session_check_idle_conn(h2c->conn->owner, h2c->conn) != 0) {
|
||||||
session_check_idle_conn(h2c->conn->owner, h2c->conn) != 0) {
|
|
||||||
/* At this point either the connection is destroyed, or it's been added to the server idle list, just stop */
|
/* At this point either the connection is destroyed, or it's been added to the server idle list, just stop */
|
||||||
TRACE_DEVEL("leaving without reusable idle connection", H2_EV_STRM_END);
|
TRACE_DEVEL("leaving without reusable idle connection", H2_EV_STRM_END);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(h2c->conn->flags & CO_FL_PRIVATE)) {
|
}
|
||||||
|
|
||||||
|
/* Be sure to remove the connection from the available_conns list */
|
||||||
|
if (!MT_LIST_ISEMPTY(&h2c->conn->list))
|
||||||
|
MT_LIST_DEL(&h2c->conn->list);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (eb_is_empty(&h2c->streams_by_id)) {
|
||||||
if (!srv_add_to_idle_list(objt_server(h2c->conn->target), h2c->conn, 1)) {
|
if (!srv_add_to_idle_list(objt_server(h2c->conn->target), h2c->conn, 1)) {
|
||||||
/* The server doesn't want it, let's kill the connection right away */
|
/* The server doesn't want it, let's kill the connection right away */
|
||||||
h2c->conn->mux->destroy(h2c);
|
h2c->conn->mux->destroy(h2c);
|
||||||
@ -3978,12 +3985,13 @@ static void h2_detach(struct conn_stream *cs)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
} else if (MT_LIST_ISEMPTY(&h2c->conn->list) &&
|
else if (MT_LIST_ISEMPTY(&h2c->conn->list) &&
|
||||||
h2_avail_streams(h2c->conn) > 0 && objt_server(h2c->conn->target)) {
|
h2_avail_streams(h2c->conn) > 0 && objt_server(h2c->conn->target)) {
|
||||||
LIST_ADD(&__objt_server(h2c->conn->target)->available_conns[tid], mt_list_to_list(&h2c->conn->list));
|
LIST_ADD(&__objt_server(h2c->conn->target)->available_conns[tid], mt_list_to_list(&h2c->conn->list));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* We don't want to close right now unless we're removing the
|
/* We don't want to close right now unless we're removing the
|
||||||
* last stream, and either the connection is in error, or it
|
* last stream, and either the connection is in error, or it
|
||||||
|
Loading…
Reference in New Issue
Block a user