From 02ef0ff0612f2e3b15e8d2442fba2069a0847262 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Thu, 21 Apr 2022 08:50:00 +0200 Subject: [PATCH] MINOR: conn-stream: Rely on endpoint shutdown flags to shutdown an applet cs_applet_shut() now relies on CS_EP_SH* flags to performed the applet shutdown. It means the applet release callback is called if there is no CS_EP_SHR or CS_EP_SHW flags set. And it set these flags, CS_EP_SHRR and CS_EP_SHWN more specifically, before exiting. This way, cs_applet_shut() is the really equivalent to cs_conn_shut(). --- src/conn_stream.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/conn_stream.c b/src/conn_stream.c index c721083ac..29bf49b05 100644 --- a/src/conn_stream.c +++ b/src/conn_stream.c @@ -476,8 +476,13 @@ void cs_applet_shut(struct conn_stream *cs) { struct appctx *appctx = __cs_appctx(cs); - if (appctx->applet->release && !cs_state_in(cs->state, CS_SB_DIS|CS_SB_CLO)) + if (cs->endp->flags & (CS_EP_SHR|CS_EP_SHW)) + return; + + if (appctx->applet->release) appctx->applet->release(appctx); + + cs->endp->flags |= CS_EP_SHRR | CS_EP_SHWN; } /*