]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: stconn: rename cs_rx_buff_{blk,rdy} to sc_{need,have}_buff()
authorWilly Tarreau <w@1wt.eu>
Wed, 25 May 2022 05:48:07 +0000 (07:48 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 27 May 2022 17:33:35 +0000 (19:33 +0200)
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.

include/haproxy/conn_stream.h
include/haproxy/cs_utils.h
src/applet.c
src/stream.c

index 8e89cc6457f8c2bea22ae91cc30d72dbf5b6c558..0418039e2842747c99e46fabab7fd090e8aa4ee0 100644 (file)
@@ -344,18 +344,20 @@ static inline void se_need_remote_conn(struct sedesc *se)
        se_fl_set(se, SE_FL_APPLET_NEED_CONN);
 }
 
-/* The stream connector just got the input buffer it was waiting for */
-static inline void cs_rx_buff_rdy(struct stconn *cs)
+/* The application layer tells the stream connector that it just got the input
+ * buffer it was waiting for.
+ */
+static inline void sc_have_buff(struct stconn *cs)
 {
        sc_ep_clr(cs, SE_FL_RXBLK_BUFF);
 }
 
 /* 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
- * have to be retried, we automatically clear RXBLK_ENDP to be called again
- * as soon as RXBLK_BUFF is cleared.
+ * It indicates a willingness to deliver data to the buffer that will have to
+ * be retried, as such, callers will often automatically clear RXBLK_ENDP to be
+ * 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);
 }
index 0da4f43fcb569e8ab08f7d2ca9f5e0c64baee77e..8ec217f2d0233745ffd117243a21e8ab4e4c9532 100644 (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);
        if (!ret)
-               cs_rx_buff_blk(cs);
+               sc_need_buff(cs);
        return ret;
 }
 
index 718b2990255e41b3fefe2ef9881b337acaaaae49..c48d36f616701a572c145e5756750b96393dd690 100644 (file)
@@ -170,7 +170,7 @@ int appctx_buf_available(void *arg)
        if (!se_fl_test(appctx->sedesc, SE_FL_RXBLK_BUFF))
                return 0;
 
-       cs_rx_buff_rdy(cs);
+       sc_have_buff(cs);
 
        /* was already allocated another way ? if so, don't take this one */
        if (c_size(sc_ic(cs)) || sc_ic(cs)->pipe)
@@ -178,7 +178,7 @@ int appctx_buf_available(void *arg)
 
        /* allocation possible now ? */
        if (!b_alloc(&sc_ic(cs)->buf)) {
-               cs_rx_buff_blk(cs);
+               sc_need_buff(cs);
                return 0;
        }
 
index 1a28900ebab65ea7f4b3343a26565f1808dc866e..c05f039c77de597bef48a48c92b8d61e23be3c2f 100644 (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) &&
            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) &&
                 b_alloc(&s->res.buf))
-               cs_rx_buff_rdy(s->scb);
+               sc_have_buff(s->scb);
        else
                return 0;