CLEANUP: stconn: rename cs_rx_chan_{blk,rdy} to sc_{wont,will}_read()
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.
diff --git a/include/haproxy/conn_stream.h b/include/haproxy/conn_stream.h
index 33b908b..8e89cc6 100644
--- a/include/haproxy/conn_stream.h
+++ b/include/haproxy/conn_stream.h
@@ -317,14 +317,19 @@
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);
}
diff --git a/src/conn_stream.c b/src/conn_stream.c
index caf33e4..b898dd9 100644
--- a/src/conn_stream.c
+++ b/src/conn_stream.c
@@ -1015,9 +1015,9 @@
/* 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 @@
}
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 @@
}
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 @@
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 @@
*/
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 @@
*/
if (ret >= global.tune.recv_enough) {
/* we're stopped by the channel's policy */
- cs_rx_chan_blk(cs);
+ sc_wont_read(cs);
break;
}
}
diff --git a/src/http_client.c b/src/http_client.c
index d0b2a58..da774e7 100644
--- a/src/http_client.c
+++ b/src/http_client.c
@@ -911,7 +911,7 @@
process_data:
- cs_rx_chan_rdy(cs);
+ sc_will_read(cs);
return;
more: