CLEANUP: stconn: rename cs_rx_buff_{blk,rdy} to sc_{need,have}_buff()

These functions are used by the application layer to disable or enable
reading at the stream connector's level when the input buffer failed to
be allocated (or was finally allocated). The new names makes things
clearer.
This commit is contained in:
Willy Tarreau 2022-05-25 07:48:07 +02:00
parent 9512ab6e00
commit 0ed73c376c
4 changed files with 13 additions and 11 deletions

View File

@ -344,18 +344,20 @@ static inline void se_need_remote_conn(struct sedesc *se)
se_fl_set(se, SE_FL_APPLET_NEED_CONN); se_fl_set(se, SE_FL_APPLET_NEED_CONN);
} }
/* The stream connector just got the input buffer it was waiting for */ /* The application layer tells the stream connector that it just got the input
static inline void cs_rx_buff_rdy(struct stconn *cs) * buffer it was waiting for.
*/
static inline void sc_have_buff(struct stconn *cs)
{ {
sc_ep_clr(cs, SE_FL_RXBLK_BUFF); sc_ep_clr(cs, SE_FL_RXBLK_BUFF);
} }
/* The stream connector failed to get an input buffer and is waiting for it. /* The stream connector failed to get an input buffer and is waiting for it.
* Since it indicates a willingness to deliver data to the buffer that will * It indicates a willingness to deliver data to the buffer that will have to
* have to be retried, we automatically clear RXBLK_ENDP to be called again * be retried, as such, callers will often automatically clear RXBLK_ENDP to be
* as soon as RXBLK_BUFF is cleared. * called again as soon as RXBLK_BUFF is cleared.
*/ */
static inline void cs_rx_buff_blk(struct stconn *cs) static inline void sc_need_buff(struct stconn *cs)
{ {
sc_ep_set(cs, SE_FL_RXBLK_BUFF); sc_ep_set(cs, SE_FL_RXBLK_BUFF);
} }

View File

@ -160,7 +160,7 @@ static inline int cs_alloc_ibuf(struct stconn *cs, struct buffer_wait *wait)
ret = channel_alloc_buffer(sc_ic(cs), wait); ret = channel_alloc_buffer(sc_ic(cs), wait);
if (!ret) if (!ret)
cs_rx_buff_blk(cs); sc_need_buff(cs);
return ret; return ret;
} }

View File

@ -170,7 +170,7 @@ int appctx_buf_available(void *arg)
if (!se_fl_test(appctx->sedesc, SE_FL_RXBLK_BUFF)) if (!se_fl_test(appctx->sedesc, SE_FL_RXBLK_BUFF))
return 0; return 0;
cs_rx_buff_rdy(cs); sc_have_buff(cs);
/* was already allocated another way ? if so, don't take this one */ /* was already allocated another way ? if so, don't take this one */
if (c_size(sc_ic(cs)) || sc_ic(cs)->pipe) if (c_size(sc_ic(cs)) || sc_ic(cs)->pipe)
@ -178,7 +178,7 @@ int appctx_buf_available(void *arg)
/* allocation possible now ? */ /* allocation possible now ? */
if (!b_alloc(&sc_ic(cs)->buf)) { if (!b_alloc(&sc_ic(cs)->buf)) {
cs_rx_buff_blk(cs); sc_need_buff(cs);
return 0; return 0;
} }

View File

@ -315,10 +315,10 @@ int stream_buf_available(void *arg)
if (!s->req.buf.size && !s->req.pipe && sc_ep_test(s->scf, SE_FL_RXBLK_BUFF) && if (!s->req.buf.size && !s->req.pipe && sc_ep_test(s->scf, SE_FL_RXBLK_BUFF) &&
b_alloc(&s->req.buf)) b_alloc(&s->req.buf))
cs_rx_buff_rdy(s->scf); sc_have_buff(s->scf);
else if (!s->res.buf.size && !s->res.pipe && sc_ep_test(s->scb, SE_FL_RXBLK_BUFF) && else if (!s->res.buf.size && !s->res.pipe && sc_ep_test(s->scb, SE_FL_RXBLK_BUFF) &&
b_alloc(&s->res.buf)) b_alloc(&s->res.buf))
cs_rx_buff_rdy(s->scb); sc_have_buff(s->scb);
else else
return 0; return 0;