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

src/stats.c

index 7ebf2e567cb6c3932ae819d8ec2d179a01d74e89..cf692dafdabf63337ab893f4d33e6ef8fffdd6ce 100644 (file)
@@ -3060,12 +3060,7 @@ static int stats_process_http_post(struct stream_interface *si)
                                                break;
                                        case ST_ADM_ACTION_SHUTDOWN:
                                                if (px->state != PR_STSTOPPED) {
-                                                       struct stream *sess, *sess_bck;
-
-                                                       list_for_each_entry_safe(sess, sess_bck, &sv->actconns, by_srv)
-                                                               if (sess->srv_conn == sv)
-                                                                       stream_shutdown(sess, SF_ERR_KILLED);
-
+                                                       srv_shutdown_streams(sv, SF_ERR_KILLED);
                                                        altered_servers++;
                                                        total_servers++;
                                                }