From: Christopher Faulet Date: Thu, 23 Nov 2023 15:51:25 +0000 (+0100) Subject: MINOR: applets: Use channel's field to compute amount of data received X-Git-Tag: v3.0-dev1~134 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f99a37ae66e73a3d71bea39dc2cfba9af781a19;p=thirdparty%2Fhaproxy.git MINOR: applets: Use channel's field to compute amount of data received To be able to support endpoint-to-endpoint fast-forwarding (formerly called mux-to-mux fast-forwarding), we cannot rely on data in the input channel to compute amount of data the applet has produced. The applet API is not really designed to know how many bytes are produced or received at each call. Till now, it was not a problem because data always passed through the channels. With E2E fast-frowarding, input data may be immediately consumed. From the caller point of view (task_run_applet), there is only the total field of the input channel that will change. So let's use it now. --- diff --git a/src/applet.c b/src/applet.c index c6e08b0bf3..5e6312efee 100644 --- a/src/applet.c +++ b/src/applet.c @@ -456,7 +456,7 @@ struct task *task_run_applet(struct task *t, void *context, unsigned int state) channel_check_idletimer(ic); - input = channel_data(ic); + input = ic->total; output = co_data(oc); app->applet->fct(app); @@ -476,7 +476,7 @@ struct task *task_run_applet(struct task *t, void *context, unsigned int state) sc_have_room(sco); } - input = channel_data(ic) - input; + input = ic->total - input; if (input) { channel_check_xfer(ic, input); sc_ep_report_read_activity(sc);