MINOR: connection: Set new connection as private on reuse never

When a new connection is created, it may immediatly be set as private if
http-reuse never is configured for the backend. There is no reason to wait the
call to mux->detach() to do so.
This commit is contained in:
Christopher Faulet 2020-07-01 15:12:43 +02:00
parent 27bd6ff96d
commit c64badd573
4 changed files with 3 additions and 10 deletions

View File

@ -1401,6 +1401,9 @@ int connect_server(struct stream *s)
if (srv_conn)
srv_conn->target = s->target;
srv_cs = NULL;
if ((s->be->options & PR_O_REUSE_MASK) == PR_O_REUSE_NEVR)
conn->flags |= CO_FL_PRIVATE;
}
if (srv_conn && srv && was_unused) {

View File

@ -3540,9 +3540,6 @@ static void fcgi_detach(struct conn_stream *cs)
if (!(fconn->conn->flags & (CO_FL_ERROR|CO_FL_SOCK_RD_SH|CO_FL_SOCK_WR_SH)) &&
(fconn->flags & FCGI_CF_KEEP_CONN)) {
/* Never ever allow to reuse a connection from a non-reuse backend */
if ((fconn->proxy->options & PR_O_REUSE_MASK) == PR_O_REUSE_NEVR)
fconn->conn->flags |= CO_FL_PRIVATE;
if (fconn->conn->flags & CO_FL_PRIVATE) {
if (!fconn->conn->owner) {
fconn->conn->owner = sess;

View File

@ -2453,10 +2453,6 @@ static void h1_detach(struct conn_stream *cs)
goto release;
}
/* Never ever allow to reuse a connection from a non-reuse backend */
if ((h1c->px->options & PR_O_REUSE_MASK) == PR_O_REUSE_NEVR)
h1c->conn->flags |= CO_FL_PRIVATE;
if (!(h1c->conn->owner) && (h1c->conn->flags & CO_FL_PRIVATE)) {
h1c->conn->owner = sess;
if (!session_add_conn(sess, h1c->conn, h1c->conn->target)) {

View File

@ -3942,9 +3942,6 @@ static void h2_detach(struct conn_stream *cs)
if (h2c->flags & H2_CF_IS_BACK) {
if (!(h2c->conn->flags &
(CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH))) {
/* Never ever allow to reuse a connection from a non-reuse backend */
if ((h2c->proxy->options & PR_O_REUSE_MASK) == PR_O_REUSE_NEVR)
h2c->conn->flags |= CO_FL_PRIVATE;
if (h2c->conn->flags & CO_FL_PRIVATE) {
if (!h2c->conn->owner) {
h2c->conn->owner = sess;