From: Aurelien DARRAGON Date: Wed, 17 Jul 2024 13:12:54 +0000 (+0200) Subject: MEDIUM: sink: start applets asynchronously X-Git-Tag: v3.1-dev4~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09d69eacf8;p=thirdparty%2Fhaproxy.git MEDIUM: sink: start applets asynchronously Since d9c1d33fa1 ("MEDIUM: applet: Add support for async appctx startup on a thread subset"), it is now possible to delay appctx's init: for that it is required that the .init callback is defined on the applet. When the applet will be processed on the first run, applet API will automatically finish the applet initialization. Thus we explicitly call appctx_wakeup() on the applet to schedule it for initial run instead of calling appctx_init() ourselves. This is done in prevision of the next patch in order to be able to schedule the applet on a different thread from the one executing sink_forward_session_create() function. Note: 'out_free_appctx' label was removed since it is no longer used. --- diff --git a/src/sink.c b/src/sink.c index 1a9165e7c9..889f8c0be9 100644 --- a/src/sink.c +++ b/src/sink.c @@ -569,15 +569,10 @@ static struct appctx *sink_forward_session_create(struct sink *sink, struct sink if (!appctx) goto out_close; appctx->svcctx = (void *)sft; - - if (appctx_init(appctx) == -1) - goto out_free_appctx; - + appctx_wakeup(appctx); return appctx; /* Error unrolling */ - out_free_appctx: - appctx_free_on_early_error(appctx); out_close: return NULL; }