]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: cli: use srv_shutdown_streams() instead of open-coding it
authorWilly Tarreau <w@1wt.eu>
Thu, 14 Nov 2019 15:37:16 +0000 (16:37 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 15 Nov 2019 06:06:46 +0000 (07:06 +0100)
The "shutdown session server" command used to open-code the list traversal
while there's already a function for this: srv_shutdown_streams(). Better
use it.

src/stream.c

index 535bf6a76e1caaceef1b568a9ebd3d1185ad82ec..c0c462c0713d37a4720217c8cf2269cf8429666e 100644 (file)
@@ -3849,7 +3849,6 @@ static int cli_parse_shutdown_session(char **args, char *payload, struct appctx
 static int cli_parse_shutdown_sessions_server(char **args, char *payload, struct appctx *appctx, void *private)
 {
        struct server *sv;
-       struct stream *strm, *strm_bck;
 
        if (!cli_has_level(appctx, ACCESS_LVL_ADMIN))
                return 1;
@@ -3860,9 +3859,7 @@ static int cli_parse_shutdown_sessions_server(char **args, char *payload, struct
 
        /* kill all the stream that are on this server */
        HA_SPIN_LOCK(SERVER_LOCK, &sv->lock);
-       list_for_each_entry_safe(strm, strm_bck, &sv->actconns, by_srv)
-               if (strm->srv_conn == sv)
-                       stream_shutdown(strm, SF_ERR_KILLED);
+       srv_shutdown_streams(sv, SF_ERR_KILLED);
        HA_SPIN_UNLOCK(SERVER_LOCK, &sv->lock);
        return 1;
 }