MINOR: cli: allow to set frontend maxconn to zero

It is sometimes useful to completely disable accepting new connections
on a frontend during maintenance operations. By setting a frontend's
maxconn to zero, connections are not accepted anymore until the limit
is increased again.
This commit is contained in:
Willy Tarreau 2012-09-26 21:07:15 +02:00
parent a7944ad9ef
commit 3c7a79dbb1
2 changed files with 6 additions and 7 deletions

View File

@ -10464,11 +10464,11 @@ quit
Close the connection when in interactive mode. Close the connection when in interactive mode.
set maxconn frontend <frontend> <value> set maxconn frontend <frontend> <value>
Dynamically change the specified frontend's maxconn setting. Any non-null Dynamically change the specified frontend's maxconn setting. Any positive
positive value is allowed, but setting values larger than the global maxconn value is allowed including zero, but setting values larger than the global
does not make much sense. If the limit is increased and connections were maxconn does not make much sense. If the limit is increased and connections
pending, they will immediately be accepted. If it is lowered to a value below were pending, they will immediately be accepted. If it is lowered to a value
the current number of connections, new connections acceptation will be below the current number of connections, new connections acceptation will be
delayed until the threshold is reached. The frontend might be specified by delayed until the threshold is reached. The frontend might be specified by
either its name or its numeric ID prefixed with a sharp ('#'). either its name or its numeric ID prefixed with a sharp ('#').

View File

@ -1113,8 +1113,7 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
} }
v = atoi(args[4]); v = atoi(args[4]);
/* check for unlimited values, we restore default setting (cfg_maxpconn) */ if (v < 0) {
if (v < 1) {
si->applet.ctx.cli.msg = "Value out of range.\n"; si->applet.ctx.cli.msg = "Value out of range.\n";
si->applet.st0 = STAT_CLI_PRINT; si->applet.st0 = STAT_CLI_PRINT;
return 1; return 1;