From: Christopher Faulet Date: Thu, 21 Apr 2022 06:50:00 +0000 (+0200) Subject: MINOR: conn-stream: Rely on endpoint shutdown flags to shutdown an applet X-Git-Tag: v2.6-dev7~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=02ef0ff0612f2e3b15e8d2442fba2069a0847262;p=thirdparty%2Fhaproxy.git 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(). --- diff --git a/src/conn_stream.c b/src/conn_stream.c index c721083ac3..29bf49b050 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; } /*