]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: stconn: rename cs_rx_chan_{blk,rdy} to sc_{wont,will}_read()
authorWilly Tarreau <w@1wt.eu>
Wed, 25 May 2022 05:35:53 +0000 (07:35 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 27 May 2022 17:33:35 +0000 (19:33 +0200)
These functions were used by the channel to inform the lower layer
whether reading was acceptable or not. Usually this directly mimmicks
the CF_DONT_READ flag from the channel, which may be set when it's
desired not to buffer incoming data that will not be processed, or
that the buffer wants to be flushed before starting to read again,
or that bandwidth limiting might be enforced, etc. It's always a
policy reason, not a purely resource-based one.

include/haproxy/conn_stream.h
src/conn_stream.c
src/http_client.c

index 33b908b89249e0a4bcbd3822cf41b5cba82f8ccf..8e89cc6457f8c2bea22ae91cc30d72dbf5b6c558 100644 (file)
@@ -317,14 +317,19 @@ static inline void cs_rx_endp_done(struct stconn *cs)
        sc_ep_set(cs, SE_FL_RX_WAIT_EP);
 }
 
-/* Tell a stream connector the input channel is OK with it sending it some data */
-static inline void cs_rx_chan_rdy(struct stconn *cs)
+/* The application layer informs a stream connector that it's willing to
+ * receive data from the endpoint.
+ */
+static inline void sc_will_read(struct stconn *cs)
 {
        sc_ep_clr(cs, SE_FL_RXBLK_CHAN);
 }
 
-/* Tell a stream connector the input channel is not OK with it sending it some data */
-static inline void cs_rx_chan_blk(struct stconn *cs)
+/* The application layer informs a stream connector that it will not receive
+ * data from the endpoint (e.g. need to flush, bw limitations etc). Usually
+ * it corresponds to the channel's CF_DONT_READ flag.
+ */
+static inline void sc_wont_read(struct stconn *cs)
 {
        sc_ep_set(cs, SE_FL_RXBLK_CHAN);
 }
index caf33e4386ca2cac70c01d8a000b866a1d7bb349..b898dd9f753c77278c2573d3ef4abc598e8fee03 100644 (file)
@@ -1015,9 +1015,9 @@ void cs_update_rx(struct stconn *cs)
 
        /* Read not closed, update FD status and timeout for reads */
        if (ic->flags & CF_DONT_READ)
-               cs_rx_chan_blk(cs);
+               sc_wont_read(cs);
        else
-               cs_rx_chan_rdy(cs);
+               sc_will_read(cs);
 
        if (!channel_is_empty(ic) || !channel_may_recv(ic)) {
                /* stop reading, imposed by channel's policy or contents */
@@ -1135,9 +1135,9 @@ static void cs_notify(struct stconn *cs)
        }
 
        if (oc->flags & CF_DONT_READ)
-               cs_rx_chan_blk(cso);
+               sc_wont_read(cso);
        else
-               cs_rx_chan_rdy(cso);
+               sc_will_read(cso);
 
        /* Notify the other side when we've injected data into the IC that
         * needs to be forwarded. We can do fast-forwarding as soon as there
@@ -1173,7 +1173,7 @@ static void cs_notify(struct stconn *cs)
        }
 
        if (!(ic->flags & CF_DONT_READ))
-               cs_rx_chan_rdy(cs);
+               sc_will_read(cs);
 
        cs_chk_rcv(cs);
        cs_chk_rcv(cso);
@@ -1489,7 +1489,7 @@ static int sc_conn_recv(struct stconn *cs)
 
                if ((ic->flags & CF_READ_DONTWAIT) || --read_poll <= 0) {
                        /* we're stopped by the channel's policy */
-                       cs_rx_chan_blk(cs);
+                       sc_wont_read(cs);
                        break;
                }
 
@@ -1504,7 +1504,7 @@ static int sc_conn_recv(struct stconn *cs)
                         */
                        if (ic->flags & CF_STREAMER) {
                                /* we're stopped by the channel's policy */
-                               cs_rx_chan_blk(cs);
+                               sc_wont_read(cs);
                                break;
                        }
 
@@ -1513,7 +1513,7 @@ static int sc_conn_recv(struct stconn *cs)
                         */
                        if (ret >= global.tune.recv_enough) {
                                /* we're stopped by the channel's policy */
-                               cs_rx_chan_blk(cs);
+                               sc_wont_read(cs);
                                break;
                        }
                }
index d0b2a58a20bd9408a3b7d64b272ae102429fbf7f..da774e759c00ca1fe63f915a1bc37b95f83dab33 100644 (file)
@@ -911,7 +911,7 @@ static void httpclient_applet_io_handler(struct appctx *appctx)
 
 process_data:
 
-       cs_rx_chan_rdy(cs);
+       sc_will_read(cs);
 
        return;
 more: