delayed until the threshold is reached. A value of zero restores the initial
setting.
+set rate-limit connections global <value>
+ Change the process-wide connection rate limit, which is set by the global
+ 'maxconnrate' setting. A value of zero disables the limitation. This limit
+ applies to all frontends and the change has an immediate effect. The value
+ is passed in number of connections per second.
+
set timeout cli <delay>
Change the CLI interface timeout for current connection. This can be useful
during long debugging sessions where the user needs to constantly inspect
" disable server : set a server in maintenance mode\n"
" enable server : re-enable a server that was previously in maintenance mode\n"
" set maxconn : change a maxconn setting\n"
+ " set rate-limit : change a rate limiting value\n"
"";
static const char stats_permission_denied_msg[] =
return 1;
}
}
+ else if (strcmp(args[1], "rate-limit") == 0) {
+ if (strcmp(args[2], "connections") == 0) {
+ if (strcmp(args[3], "global") == 0) {
+ int v;
+
+ if (s->listener->perm.ux.level < ACCESS_LVL_ADMIN) {
+ si->applet.ctx.cli.msg = stats_permission_denied_msg;
+ si->applet.st0 = STAT_CLI_PRINT;
+ return 1;
+ }
+
+ if (!*args[4]) {
+ si->applet.ctx.cli.msg = "Expects an integer value.\n";
+ si->applet.st0 = STAT_CLI_PRINT;
+ return 1;
+ }
+
+ v = atoi(args[4]);
+ if (v < 0) {
+ si->applet.ctx.cli.msg = "Value out of range.\n";
+ si->applet.st0 = STAT_CLI_PRINT;
+ return 1;
+ }
+
+ global.cps_lim = v;
+
+ /* Dequeues all of the listeners waiting for a resource */
+ if (!LIST_ISEMPTY(&global_listener_queue))
+ dequeue_all_listeners(&global_listener_queue);
+
+ return 1;
+ }
+ else {
+ si->applet.ctx.cli.msg = "'set rate-limit connections' only supports 'global'.\n";
+ si->applet.st0 = STAT_CLI_PRINT;
+ return 1;
+ }
+ }
+ else {
+ si->applet.ctx.cli.msg = "'set rate-limit' only supports 'connections'.\n";
+ si->applet.st0 = STAT_CLI_PRINT;
+ return 1;
+ }
+ }
else { /* unknown "set" parameter */
return 0;
}