MINOR: stconn/applet: Add BUG_ON_HOT() to be sure SE_FL_EOS is never set alone
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 23 Mar 2023 16:30:29 +0000 (17:30 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 5 Apr 2023 06:57:06 +0000 (08:57 +0200)
SE_FL_EOS flag must never be set on the SE descriptor without SE_FL_EOI or
SE_FL_ERROR. When a mux or an applet report an end of stream, it must be
able to state if it is the end of input too or if it is an error.

Because all this part was recently refactored, especially the applet part,
it is a bit sensitive. Thus a BUG_ON_HOT() is used and not a BUG_ON().

src/applet.c
src/stconn.c

index b9bb992..41f1b08 100644 (file)
@@ -477,6 +477,8 @@ struct task *task_run_applet(struct task *t, void *context, unsigned int state)
                        stream_dump_and_crash(&app->obj_type, read_freq_ctr(&app->call_rate));
        }
 
+       BUG_ON_HOT((sc_ep_get(sc) & (SE_FL_EOI|SE_FL_EOS|SE_FL_ERROR)) == SE_FL_EOS);
+
        sc->app_ops->wake(sc);
        channel_release_buffer(sc_ic(sc), &app->buffer_wait);
        TRACE_LEAVE(APPLET_EV_PROCESS, app);
index 061a003..b1d02d9 100644 (file)
@@ -1502,6 +1502,8 @@ static int sc_conn_recv(struct stconn *sc)
                se_have_more_data(sc->sedesc);
                ret = 1;
        }
+
+       BUG_ON_HOT((sc_ep_get(sc) & (SE_FL_EOI|SE_FL_EOS|SE_FL_ERROR)) == SE_FL_EOS);
        return ret;
 }