]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: stconn: rename cs_{want,stop}_get() to se_{will,wont}_consume()
authorWilly Tarreau <w@1wt.eu>
Wed, 25 May 2022 16:12:11 +0000 (18:12 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 27 May 2022 17:33:35 +0000 (19:33 +0200)
These ones are essentially for the stream endpoint, let's give them a
name that matches the intent. Equivalent versions were provided in the
applet namespace to ease code legibility.

include/haproxy/applet.h
include/haproxy/conn_stream.h
src/flt_spoe.c
src/stats.c
src/stream.c

index e7c1e29633014124319d1ea7a19ba0fdf7992017..35b600b0fd3e403b2e43895bd0bda80afbabafe9 100644 (file)
@@ -144,6 +144,22 @@ static inline void applet_have_no_more_data(struct appctx *appctx)
        se_fl_set(appctx->sedesc, SE_FL_HAVE_NO_DATA);
 }
 
+/* The applet indicates that it's ready to consume data from the stream's
+ * output buffer.
+ */
+static inline void applet_will_consume(struct appctx *appctx)
+{
+       se_fl_set(appctx->sedesc, SE_FL_WILL_CONSUME);
+}
+
+/* The applet indicates that it's not willing to consume data from the stream's
+ * output buffer.
+ */
+static inline void applet_wont_consume(struct appctx *appctx)
+{
+       se_fl_clr(appctx->sedesc, SE_FL_WILL_CONSUME);
+}
+
 /* writes chunk <chunk> into the input channel of the stream attached to this
  * appctx's endpoint, and marks the SC_FL_NEED_ROOM on a channel full error.
  * See ci_putchk() for the list of return codes.
index 7f15dff130474157d43e98ac19c492045c543f07..2f7b457d424e3cb225904d15780017ac43d49cf2 100644 (file)
@@ -373,22 +373,26 @@ static inline void sc_need_room(struct stconn *sc)
        sc->flags |= SC_FL_NEED_ROOM;
 }
 
-/* Report that a stream connector wants to get some data from the output buffer */
-static inline void cs_want_get(struct stconn *cs)
+/* The stream endpoint indicates that it's ready to consume data from the
+ * stream's output buffer.
+ */
+static inline void se_will_consume(struct sedesc *se)
 {
-       sc_ep_set(cs, SE_FL_WILL_CONSUME);
+       se_fl_set(se, SE_FL_WILL_CONSUME);
 }
 
-/* Report that a stream connector failed to get some data from the output buffer */
-static inline void cs_cant_get(struct stconn *cs)
+/* The stream endpoint indicates that it's not willing to consume data from the
+ * stream's output buffer.
+ */
+static inline void se_wont_consume(struct sedesc *se)
 {
-       sc_ep_set(cs, SE_FL_WILL_CONSUME | SE_FL_WAIT_DATA);
+       se_fl_clr(se, SE_FL_WILL_CONSUME);
 }
 
-/* Report that a stream connector doesn't want to get data from the output buffer */
-static inline void cs_stop_get(struct stconn *cs)
+/* Report that a stream connector failed to get some data from the output buffer */
+static inline void cs_cant_get(struct stconn *cs)
 {
-       sc_ep_clr(cs, SE_FL_WILL_CONSUME);
+       sc_ep_set(cs, SE_FL_WILL_CONSUME | SE_FL_WAIT_DATA);
 }
 
 #endif /* _HAPROXY_CONN_STREAM_H */
index 90c3e01fa0e6dff924d87cd45533b68169d3283a..fc41f5222c17472bfecc413c27361a0c744b1bf7 100644 (file)
@@ -1193,7 +1193,7 @@ spoe_recv_frame(struct appctx *appctx, char *buf, size_t framesz)
 static int
 spoe_wakeup_appctx(struct appctx *appctx)
 {
-       cs_want_get(appctx_cs(appctx));
+       applet_will_consume(appctx);
        applet_have_more_data(appctx);
        appctx_wakeup(appctx);
        return 1;
index 8b55114c9daaf9b3e66dfac47c7c61e814117d91..cd9dd452d7eabf8fca1f05ba8f146c59c698d5d7 100644 (file)
@@ -4377,7 +4377,7 @@ static void http_stats_io_handler(struct appctx *appctx)
         */
        htx_to_buf(res_htx, &res->buf);
        if (!channel_is_empty(res))
-               cs_stop_get(cs);
+               applet_wont_consume(appctx);
 }
 
 /* Dump all fields from <info> into <out> using the "show info" format (name: value) */
index c46bbe073d890bcec876398a8b377c51a2ea6901..4ca48fe16f295e71605b1f8bb2b55649facb7b36 100644 (file)
@@ -537,7 +537,7 @@ struct stream *stream_new(struct session *sess, struct stconn *cs, struct buffer
 
        /* finish initialization of the accepted file descriptor */
        if (sc_appctx(cs))
-               cs_want_get(s->scf);
+               se_will_consume(s->scf->sedesc);
 
        if (sess->fe->accept && sess->fe->accept(s) < 0)
                goto out_fail_accept;