From: Christopher Faulet Date: Mon, 5 Jun 2023 06:15:59 +0000 (+0200) Subject: BUG/MINOR: spoe: Only skip sending new frame after a receive attempt X-Git-Tag: v2.9-dev1~72 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bc9fb646236634a26d4f3cffe64fa91f213d8eed;p=thirdparty%2Fhaproxy.git BUG/MINOR: spoe: Only skip sending new frame after a receive attempt When a SPOE appctx is processing frames in sync mode, we must only skip sending a new frame if it is still waiting for a ACK frame after a receive attempt. It was performed before the receive attempt. As a consequence, if the ACK frame was received, the SPOE appctx did not try to process queued messages immediately. This could increase the queue time and thus slow down the processing time of the stream. Thanks to Daniel Epperson for his help to diagnose the bug. This patch must be backported to every stable versions. --- diff --git a/src/flt_spoe.c b/src/flt_spoe.c index 8d31780db7..65f20cec19 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -1730,12 +1730,6 @@ spoe_handle_processing_appctx(struct appctx *appctx) (agent->b.be->queue.length || (srv && (srv->queue.length || (srv->maxconn && srv->served >= srv_dynamic_maxconn(srv)))))); - /* Don"t try to send new frame we are waiting for at lease a ack, in - * sync mode or if applet must be closed ASAP - */ - if (appctx->st0 == SPOE_APPCTX_ST_WAITING_SYNC_ACK || (close_asap && SPOE_APPCTX(appctx)->cur_fpa)) - skip_sending = 1; - /* receiving_frame loop */ while (!skip_receiving) { ret = spoe_handle_receiving_frame_appctx(appctx, &skip_receiving); @@ -1756,6 +1750,12 @@ spoe_handle_processing_appctx(struct appctx *appctx) } } + /* Don"t try to send new frame we are waiting for at lease a ack, in + * sync mode or if applet must be closed ASAP + */ + if (appctx->st0 == SPOE_APPCTX_ST_WAITING_SYNC_ACK || (close_asap && SPOE_APPCTX(appctx)->cur_fpa)) + skip_sending = 1; + /* send_frame loop */ while (!skip_sending && SPOE_APPCTX(appctx)->cur_fpa < agent->max_fpa) { ret = spoe_handle_sending_frame_appctx(appctx, &skip_sending);