From: Willy Tarreau Date: Wed, 25 May 2022 16:12:11 +0000 (+0200) Subject: CLEANUP: stconn: rename cs_{want,stop}_get() to se_{will,wont}_consume() X-Git-Tag: v2.6-dev12~52 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=75a8f8e290b1eb469aab369f59859f27161460fb;p=thirdparty%2Fhaproxy.git CLEANUP: stconn: rename cs_{want,stop}_get() to se_{will,wont}_consume() 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. --- diff --git a/include/haproxy/applet.h b/include/haproxy/applet.h index e7c1e29633..35b600b0fd 100644 --- a/include/haproxy/applet.h +++ b/include/haproxy/applet.h @@ -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 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. diff --git a/include/haproxy/conn_stream.h b/include/haproxy/conn_stream.h index 7f15dff130..2f7b457d42 100644 --- a/include/haproxy/conn_stream.h +++ b/include/haproxy/conn_stream.h @@ -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 */ diff --git a/src/flt_spoe.c b/src/flt_spoe.c index 90c3e01fa0..fc41f5222c 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -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; diff --git a/src/stats.c b/src/stats.c index 8b55114c9d..cd9dd452d7 100644 --- a/src/stats.c +++ b/src/stats.c @@ -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 into using the "show info" format (name: value) */ diff --git a/src/stream.c b/src/stream.c index c46bbe073d..4ca48fe16f 100644 --- a/src/stream.c +++ b/src/stream.c @@ -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;