]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: cli/ring: Properly handle shutdown in "show event" I/O handler
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 26 May 2025 12:25:16 +0000 (14:25 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 26 May 2025 17:00:00 +0000 (19:00 +0200)
The commit 03dc54d802 ("BUG/MINOR: ring: Fix I/O handler of "show event"
command to not rely on the SC") introduced a regression. By removing
dependencies on the SC, a test to detect client shutdowns was removed. So
now, the CLI applet is no longer released when the client shut the
connection during a "show event -w".

So of course, we should not use the SC to detect the shutdowns. But the SE
must be used insteead.

It is a 3.2-specific issue, so no backport needed.

src/ring.c

index 5e3f23dabf10a4ffff4da1dc14b34c4c9573bc3a..9e3cd6e1cbcc95f1f97a221b069542455072fd72 100644 (file)
@@ -710,7 +710,7 @@ int cli_io_handler_show_ring(struct appctx *appctx)
                /* we've drained everything and are configured to wait for more
                 * data or an event (keypress, close)
                 */
-               if (!b_data(&appctx->inbuf)) {
+               if (!b_data(&appctx->inbuf) && !se_fl_test(appctx->sedesc, SE_FL_SHW)) {
                        /* let's be woken up once new data arrive */
                        MT_LIST_APPEND(&ring->waiters, &appctx->wait_entry);
                        ofs = ring_tail(ring);