From: Christopher Faulet Date: Mon, 27 Feb 2023 15:32:30 +0000 (+0100) Subject: MINOR: stconn: Report a send activity when endpoint is willing to consume data X-Git-Tag: v2.8-dev5~91 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8aabc8ebfd4514c3b3290ac2ddf6a2281e01dadb;p=thirdparty%2Fhaproxy.git MINOR: stconn: Report a send activity when endpoint is willing to consume data When the endpoint (applet or mux) is now willing to consume data while it said it wouldn't, a send activity is reported. Indeed, the writes was blocked because of the endpoint. It is now ready to consume outgoing data. So an send activity must be reported to reset corresponding timers. Concretly, when the flag SE_FL_WONT_CONSULE is removed, a send activity is reported. --- diff --git a/include/haproxy/applet.h b/include/haproxy/applet.h index 5acdfdb20e..e610ba4f66 100644 --- a/include/haproxy/applet.h +++ b/include/haproxy/applet.h @@ -141,29 +141,28 @@ static inline void applet_have_no_more_data(struct appctx *appctx) } /* The applet indicates that it's ready to consume data from the stream's - * output buffer. + * output buffer. Rely on the corresponding SE function */ static inline void applet_will_consume(struct appctx *appctx) { - se_fl_clr(appctx->sedesc, SE_FL_WONT_CONSUME); + se_will_consume(appctx->sedesc); } /* The applet indicates that it's not willing to consume data from the stream's - * output buffer. + * output buffer. Rely on the corresponding SE function */ static inline void applet_wont_consume(struct appctx *appctx) { - se_fl_set(appctx->sedesc, SE_FL_WONT_CONSUME); + se_wont_consume(appctx->sedesc); } /* The applet indicates that it's willing to consume data from the stream's * output buffer, but that there's not enough, so it doesn't want to be woken - * up until more are presented. + * up until more are presented. Rely on the corresponding SE function */ static inline void applet_need_more_data(struct appctx *appctx) { - se_fl_clr(appctx->sedesc, SE_FL_WONT_CONSUME); - se_fl_set(appctx->sedesc, SE_FL_WAIT_DATA); + se_need_more_data(appctx->sedesc); } /* The applet indicates that it does not expect data from the opposite endpoint. diff --git a/include/haproxy/stconn.h b/include/haproxy/stconn.h index 27e61071be..5ee73d0f2f 100644 --- a/include/haproxy/stconn.h +++ b/include/haproxy/stconn.h @@ -448,11 +448,14 @@ static inline void sc_need_room(struct stconn *sc) } /* The stream endpoint indicates that it's ready to consume data from the - * stream's output buffer. + * stream's output buffer. Report a send activity if the SE is unblocked. */ static inline void se_will_consume(struct sedesc *se) { - se_fl_clr(se, SE_FL_WONT_CONSUME); + if (se_fl_test(se, SE_FL_WONT_CONSUME)) { + se_fl_clr(se, SE_FL_WONT_CONSUME); + sc_ep_report_send_activity(se->sc); + } } /* The stream endpoint indicates that it's not willing to consume data from the @@ -469,7 +472,7 @@ static inline void se_wont_consume(struct sedesc *se) */ static inline void se_need_more_data(struct sedesc *se) { - se_fl_clr(se, SE_FL_WONT_CONSUME); + se_will_consume(se); se_fl_set(se, SE_FL_WAIT_DATA); }