mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-05-04 20:46:11 +02:00
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.
This commit is contained in:
parent
9f07b697ee
commit
75a8f8e290
@ -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.
|
||||
|
||||
@ -373,10 +373,20 @@ 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);
|
||||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
se_fl_clr(se, SE_FL_WILL_CONSUME);
|
||||
}
|
||||
|
||||
/* Report that a stream connector failed to get some data from the output buffer */
|
||||
@ -385,10 +395,4 @@ static inline void cs_cant_get(struct stconn *cs)
|
||||
sc_ep_set(cs, SE_FL_WILL_CONSUME | SE_FL_WAIT_DATA);
|
||||
}
|
||||
|
||||
/* Report that a stream connector doesn't want to get data from the output buffer */
|
||||
static inline void cs_stop_get(struct stconn *cs)
|
||||
{
|
||||
sc_ep_clr(cs, SE_FL_WILL_CONSUME);
|
||||
}
|
||||
|
||||
#endif /* _HAPROXY_CONN_STREAM_H */
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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) */
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user