mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-05-05 04:56:10 +02:00
MEDIUM: session: close new idle conns if server in maintenance
Previous patch ensures that a backend connection going into idle state is rejected and freed if its target server is in maintenance. This patch introduces a similar change for connections attached in the session. session_check_idle_conn() now returns an errorl if connection target server is in maintenance, similarly to session max idle conns limit reached. This is sufficient to instruct muxes to delete the connection immediately.
This commit is contained in:
parent
67df6577ff
commit
fa1a168bf1
@ -705,6 +705,8 @@ int session_add_conn(struct session *sess, struct connection *conn)
|
||||
*/
|
||||
int session_check_idle_conn(struct session *sess, struct connection *conn)
|
||||
{
|
||||
struct server *srv = objt_server(conn->target);
|
||||
|
||||
/* Connection must be attached to session prior to this function call. */
|
||||
BUG_ON(!conn->owner || conn->owner != sess);
|
||||
|
||||
@ -715,7 +717,8 @@ int session_check_idle_conn(struct session *sess, struct connection *conn)
|
||||
/* Ensure conn is not already accounted as idle to prevent sess idle count excess increment. */
|
||||
BUG_ON(conn->flags & CO_FL_SESS_IDLE);
|
||||
|
||||
if (sess->idle_conns >= sess->fe->max_out_conns) {
|
||||
if (sess->idle_conns >= sess->fe->max_out_conns ||
|
||||
(srv && (srv->cur_admin & SRV_ADMF_MAINT))) {
|
||||
session_unown_conn(sess, conn);
|
||||
conn->owner = NULL;
|
||||
return -1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user