From 8019f78326993a50458a69534c5b29e1266cbb05 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Thu, 23 Mar 2023 17:30:29 +0100 Subject: [PATCH] MINOR: stconn/applet: Add BUG_ON_HOT() to be sure SE_FL_EOS is never set alone 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 | 2 ++ src/stconn.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/applet.c b/src/applet.c index b9bb9928b..41f1b0803 100644 --- a/src/applet.c +++ b/src/applet.c @@ -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); diff --git a/src/stconn.c b/src/stconn.c index 061a003b8..b1d02d95f 100644 --- a/src/stconn.c +++ b/src/stconn.c @@ -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; } -- 2.47.3