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.
This commit is contained in:
parent
99615ed85d
commit
9512ab6e00
@ -317,14 +317,19 @@ static inline void cs_rx_endp_done(struct stconn *cs)
|
|||||||
sc_ep_set(cs, SE_FL_RX_WAIT_EP);
|
sc_ep_set(cs, SE_FL_RX_WAIT_EP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tell a stream connector the input channel is OK with it sending it some data */
|
/* The application layer informs a stream connector that it's willing to
|
||||||
static inline void cs_rx_chan_rdy(struct stconn *cs)
|
* receive data from the endpoint.
|
||||||
|
*/
|
||||||
|
static inline void sc_will_read(struct stconn *cs)
|
||||||
{
|
{
|
||||||
sc_ep_clr(cs, SE_FL_RXBLK_CHAN);
|
sc_ep_clr(cs, SE_FL_RXBLK_CHAN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tell a stream connector the input channel is not OK with it sending it some data */
|
/* The application layer informs a stream connector that it will not receive
|
||||||
static inline void cs_rx_chan_blk(struct stconn *cs)
|
* 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);
|
sc_ep_set(cs, SE_FL_RXBLK_CHAN);
|
||||||
}
|
}
|
||||||
|
@ -1015,9 +1015,9 @@ void cs_update_rx(struct stconn *cs)
|
|||||||
|
|
||||||
/* Read not closed, update FD status and timeout for reads */
|
/* Read not closed, update FD status and timeout for reads */
|
||||||
if (ic->flags & CF_DONT_READ)
|
if (ic->flags & CF_DONT_READ)
|
||||||
cs_rx_chan_blk(cs);
|
sc_wont_read(cs);
|
||||||
else
|
else
|
||||||
cs_rx_chan_rdy(cs);
|
sc_will_read(cs);
|
||||||
|
|
||||||
if (!channel_is_empty(ic) || !channel_may_recv(ic)) {
|
if (!channel_is_empty(ic) || !channel_may_recv(ic)) {
|
||||||
/* stop reading, imposed by channel's policy or contents */
|
/* 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)
|
if (oc->flags & CF_DONT_READ)
|
||||||
cs_rx_chan_blk(cso);
|
sc_wont_read(cso);
|
||||||
else
|
else
|
||||||
cs_rx_chan_rdy(cso);
|
sc_will_read(cso);
|
||||||
|
|
||||||
/* Notify the other side when we've injected data into the IC that
|
/* 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
|
* 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))
|
if (!(ic->flags & CF_DONT_READ))
|
||||||
cs_rx_chan_rdy(cs);
|
sc_will_read(cs);
|
||||||
|
|
||||||
cs_chk_rcv(cs);
|
cs_chk_rcv(cs);
|
||||||
cs_chk_rcv(cso);
|
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) {
|
if ((ic->flags & CF_READ_DONTWAIT) || --read_poll <= 0) {
|
||||||
/* we're stopped by the channel's policy */
|
/* we're stopped by the channel's policy */
|
||||||
cs_rx_chan_blk(cs);
|
sc_wont_read(cs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1504,7 +1504,7 @@ static int sc_conn_recv(struct stconn *cs)
|
|||||||
*/
|
*/
|
||||||
if (ic->flags & CF_STREAMER) {
|
if (ic->flags & CF_STREAMER) {
|
||||||
/* we're stopped by the channel's policy */
|
/* we're stopped by the channel's policy */
|
||||||
cs_rx_chan_blk(cs);
|
sc_wont_read(cs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1513,7 +1513,7 @@ static int sc_conn_recv(struct stconn *cs)
|
|||||||
*/
|
*/
|
||||||
if (ret >= global.tune.recv_enough) {
|
if (ret >= global.tune.recv_enough) {
|
||||||
/* we're stopped by the channel's policy */
|
/* we're stopped by the channel's policy */
|
||||||
cs_rx_chan_blk(cs);
|
sc_wont_read(cs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -911,7 +911,7 @@ static void httpclient_applet_io_handler(struct appctx *appctx)
|
|||||||
|
|
||||||
process_data:
|
process_data:
|
||||||
|
|
||||||
cs_rx_chan_rdy(cs);
|
sc_will_read(cs);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
more:
|
more:
|
||||||
|
Loading…
Reference in New Issue
Block a user