]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: Use server_parse_maxconn_change_request for maxconn CLI updates
authorNenad Merdanovic <nmerdan@anine.io>
Sun, 24 Apr 2016 21:10:07 +0000 (23:10 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 Apr 2016 15:23:50 +0000 (17:23 +0200)
src/dumpstats.c

index da26f80d7f32cda137db10861ca8ff5b854140a2..bb62c412f4c1c14cceb703cc7259e74fcd747728 100644 (file)
@@ -1827,34 +1827,18 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
                        }
                        else if (strcmp(args[2], "server") == 0) {
                                struct server *sv;
-                               int v;
+                               const char *warning;
 
                                sv = expect_server_admin(s, si, args[3]);
                                if (!sv)
                                        return 1;
 
-                               if (!*args[4]) {
-                                       appctx->ctx.cli.msg = "Integer value expected.\n";
-                                       appctx->st0 = STAT_CLI_PRINT;
-                                       return 1;
-                               }
-
-                               v = atoi(args[4]);
-                               if (v < 0) {
-                                       appctx->ctx.cli.msg = "Value out of range.\n";
+                               warning = server_parse_maxconn_change_request(sv, args[4]);
+                               if (warning) {
+                                       appctx->ctx.cli.msg = warning;
                                        appctx->st0 = STAT_CLI_PRINT;
-                                       return 1;
-                               }
-
-                               if (sv->maxconn == sv->minconn) { // static maxconn
-                                       sv->maxconn = sv->minconn = v;
-                               } else { // dynamic maxconn
-                                       sv->maxconn = v;
                                }
 
-                               if (may_dequeue_tasks(sv, sv->proxy))
-                                       process_srv_queue(sv);
-
                                return 1;
                        }
                        else if (strcmp(args[2], "global") == 0) {