]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: applet: Identify applets using their own buffers via a flag
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 6 Feb 2024 06:45:02 +0000 (07:45 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 7 Feb 2024 14:05:05 +0000 (15:05 +0100)
These applets can now be identified by testing APPCTX_FL_INOUT_BUFS
flag. This will be useful between the kind of applets in helper functions.

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

index 9ee8f5d9cf7ec493d3365dc04eb27c1e57b826e9..8360c85576ce4ddc9133250797169dea6db5eecd 100644 (file)
@@ -46,6 +46,7 @@
 #define APPCTX_FL_ERROR          0x00000080
 #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 */
+#define APPCTX_FL_INOUT_BUFS     0x00000400  /* applet uses its own buffers */
 
 struct appctx;
 struct proxy;
index 362811718f22f65843c1146411a9f80eb2fc9cb5..984ff2661bd54b0e01637000cfe05f0cf9acb0f9 100644 (file)
@@ -260,17 +260,20 @@ struct appctx *appctx_new_on(struct applet *applet, struct sedesc *sedesc, int t
        }
 
        appctx->sedesc = sedesc;
-       if (applet->rcv_buf != NULL && applet->snd_buf != NULL)
-               appctx->t->process = task_process_applet;
-       else
-               appctx->t->process = task_run_applet;
-       appctx->t->context = appctx;
 
        appctx->flags = 0;
        appctx->inbuf = BUF_NULL;
        appctx->outbuf = BUF_NULL;
        appctx->to_forward = 0;
 
+       if (applet->rcv_buf != NULL && applet->snd_buf != NULL) {
+               appctx->t->process = task_process_applet;
+               appctx->flags |= APPCTX_FL_INOUT_BUFS;
+       }
+       else
+               appctx->t->process = task_run_applet;
+       appctx->t->context = appctx;
+
        LIST_INIT(&appctx->buffer_wait.list);
        appctx->buffer_wait.target = appctx;
        appctx->buffer_wait.wakeup_cb = appctx_buf_available;