]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: applet: Add an appctx flag to report shutdown to applets
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 23 Jan 2024 06:42:08 +0000 (07:42 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 7 Feb 2024 14:03:50 +0000 (15:03 +0100)
There is no shutdown for reads and send with applets. Both are performed
when the appctx is released. So instead of 2 flags, like for
muxes/connections, only one flag is used. But the idea is the same:
acknowledge the event at the applet level.

include/haproxy/applet-t.h
src/applet.c

index bd3bf68ca0fffdcba746de72aedcf8bbd29583f5..f4e42410895b02e06ef7670ae8baf928abccb4ce 100644 (file)
@@ -44,7 +44,8 @@
 #define APPCTX_FL_EOS            0x00000020
 #define APPCTX_FL_ERR_PENDING    0x00000040
 #define APPCTX_FL_ERROR          0x00000080
-#define APPCTX_FL_WANT_DIE       0x00000100  /* applet was running and requested to die */
+#define APPCTX_FL_SHUTDOWN       0x00000100  /* applet was shut down (->release() called if any). No more data exchange with SCs */
+#define APPCTX_FL_WANT_DIE       0x00000200  /* applet was running and requested to die */
 
 struct appctx;
 struct proxy;
index 77f69346a93a0d34a12ef2e848df090230321a02..90918c882739298f9a244db06a29097118a65209 100644 (file)
@@ -395,6 +395,7 @@ void appctx_shut(struct appctx *appctx)
        TRACE_ENTER(APPLET_EV_RELEASE, appctx);
        if (appctx->applet->release)
                appctx->applet->release(appctx);
+       applet_fl_set(appctx, APPCTX_FL_SHUTDOWN);
 
        if (LIST_INLIST(&appctx->buffer_wait.list))
                LIST_DEL_INIT(&appctx->buffer_wait.list);