From d9e26a7dd50717255d15f3db16d6ec776d5871c1 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 14 Nov 2019 16:37:16 +0100 Subject: [PATCH] CLEANUP: cli: use srv_shutdown_streams() instead of open-coding it 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 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/stream.c b/src/stream.c index 535bf6a76..c0c462c07 100644 --- a/src/stream.c +++ b/src/stream.c @@ -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; }