]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stconn: Report a send activity when endpoint is willing to consume data
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 27 Feb 2023 15:32:30 +0000 (16:32 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 27 Feb 2023 16:45:45 +0000 (17:45 +0100)
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.

include/haproxy/applet.h
include/haproxy/stconn.h

index 5acdfdb20e55079e8f327742c483c7b8d49ce5fb..e610ba4f66e14b295f9bbcecec0d1b4feae1af32 100644 (file)
@@ -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.
index 27e61071bef45cdc3ece09d56e7eaaa85336f925..5ee73d0f2f0828e0d11b291f534bed9b45135333 100644 (file)
@@ -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);
 }