mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 15:17:01 +02:00
CLEANUP: stconn: rename SE_FL_RX_WAIT_EP to SE_FL_HAVE_NO_DATA
It's more explicit this way. The cs_rx_endp_ready() function could be removed so that the flag is directly tested. In the future it should be inverted and the few places where it's set (or preserved via SE_FL_APP_MASK) could be dropped.
This commit is contained in:
parent
13d63afacd
commit
8c02f8de14
@ -188,7 +188,7 @@ void show_endp_flags(unsigned int f)
|
||||
SHOW_FLAG(f, SE_FL_RXBLK_BUFF);
|
||||
SHOW_FLAG(f, SE_FL_RXBLK_ROOM);
|
||||
SHOW_FLAG(f, SE_FL_APPLET_NEED_CONN);
|
||||
SHOW_FLAG(f, SE_FL_RX_WAIT_EP);
|
||||
SHOW_FLAG(f, SE_FL_HAVE_NO_DATA);
|
||||
SHOW_FLAG(f, SE_FL_WANT_GET);
|
||||
SHOW_FLAG(f, SE_FL_WAIT_DATA);
|
||||
SHOW_FLAG(f, SE_FL_KILL_CONN);
|
||||
|
@ -133,7 +133,7 @@ static inline struct stream *appctx_strm(const struct appctx *appctx)
|
||||
*/
|
||||
static inline void applet_have_more_data(struct appctx *appctx)
|
||||
{
|
||||
se_fl_clr(appctx->sedesc, SE_FL_RX_WAIT_EP);
|
||||
se_fl_clr(appctx->sedesc, SE_FL_HAVE_NO_DATA);
|
||||
}
|
||||
|
||||
/* The applet announces it doesn't have more data for the stream's input
|
||||
@ -141,7 +141,7 @@ static inline void applet_have_more_data(struct appctx *appctx)
|
||||
*/
|
||||
static inline void applet_have_no_more_data(struct appctx *appctx)
|
||||
{
|
||||
se_fl_set(appctx->sedesc, SE_FL_RX_WAIT_EP);
|
||||
se_fl_set(appctx->sedesc, SE_FL_HAVE_NO_DATA);
|
||||
}
|
||||
|
||||
/* writes chunk <chunk> into the input channel of the stream attached to this
|
||||
|
@ -74,7 +74,7 @@ enum se_flags {
|
||||
SE_FL_KILL_CONN = 0x00400000, /* must kill the connection when the CS closes */
|
||||
SE_FL_WAIT_DATA = 0x00800000, /* CS waits for more outgoing data to send */
|
||||
SE_FL_WANT_GET = 0x01000000, /* CS would like to get some data from the buffer */
|
||||
SE_FL_RX_WAIT_EP = 0x02000000, /* CS waits for more data from the end point */
|
||||
SE_FL_HAVE_NO_DATA = 0x02000000, /* the endpoint has no more data to deliver to the stream */
|
||||
SE_FL_RXBLK_CHAN = 0x04000000, /* the channel doesn't want the CS to introduce data */
|
||||
SE_FL_RXBLK_BUFF = 0x08000000, /* CS waits for a buffer allocation to complete */
|
||||
SE_FL_RXBLK_ROOM = 0x10000000, /* CS waits for more buffer room to store incoming data */
|
||||
|
@ -299,18 +299,12 @@ static inline int sc_waiting_room(const struct stconn *cs)
|
||||
return !!sc_ep_test(cs, SE_FL_RXBLK_ROOM);
|
||||
}
|
||||
|
||||
/* Returns non-zero if the stream connector's endpoint is ready to receive */
|
||||
static inline int cs_rx_endp_ready(const struct stconn *cs)
|
||||
{
|
||||
return !sc_ep_test(cs, SE_FL_RX_WAIT_EP);
|
||||
}
|
||||
|
||||
/* The stream endpoint announces it has more data to deliver to the stream's
|
||||
* input buffer.
|
||||
*/
|
||||
static inline void se_have_more_data(struct sedesc *se)
|
||||
{
|
||||
se_fl_clr(se, SE_FL_RX_WAIT_EP);
|
||||
se_fl_clr(se, SE_FL_HAVE_NO_DATA);
|
||||
}
|
||||
|
||||
/* The stream endpoint announces it doesn't have more data for the stream's
|
||||
@ -318,7 +312,7 @@ static inline void se_have_more_data(struct sedesc *se)
|
||||
*/
|
||||
static inline void se_have_no_more_data(struct sedesc *se)
|
||||
{
|
||||
se_fl_set(se, SE_FL_RX_WAIT_EP);
|
||||
se_fl_set(se, SE_FL_HAVE_NO_DATA);
|
||||
}
|
||||
|
||||
/* The application layer informs a stream connector that it's willing to
|
||||
@ -358,7 +352,7 @@ static inline void sc_have_buff(struct stconn *cs)
|
||||
|
||||
/* The stream connector failed to get an input buffer and is waiting for it.
|
||||
* 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
|
||||
* be retried. As such, callers will often automatically clear SE_FL_HAVE_NO_DATA
|
||||
* called again as soon as RXBLK_BUFF is cleared.
|
||||
*/
|
||||
static inline void sc_need_buff(struct stconn *cs)
|
||||
@ -378,7 +372,7 @@ static inline void sc_have_room(struct stconn *cs)
|
||||
/* The stream connector announces it failed to put data into the input buffer
|
||||
* by lack of room. Since it indicates a willingness to deliver data to the
|
||||
* buffer that will have to be retried. Usually the caller will also clear
|
||||
* RXBLK_ENDP to be called again as soon as RXBLK_ROOM is cleared.
|
||||
* SE_FL_HAVE_NO_DATA to be called again as soon as RXBLK_ROOM is cleared.
|
||||
*/
|
||||
static inline void sc_need_room(struct stconn *cs)
|
||||
{
|
||||
|
@ -151,7 +151,7 @@ static inline int cs_is_conn_error(const struct stconn *cs)
|
||||
* failure, non-zero otherwise. If no buffer is available, the requester,
|
||||
* represented by the <wait> pointer, will be added in the list of objects
|
||||
* waiting for an available buffer, and SE_FL_RXBLK_BUFF will be set on the
|
||||
* stream connector and SE_FL_RX_WAIT_EP cleared. The requester will be responsible
|
||||
* stream connector and SE_FL_HAVE_NO_DATA cleared. The requester will be responsible
|
||||
* for calling this function to try again once woken up.
|
||||
*/
|
||||
static inline int cs_alloc_ibuf(struct stconn *cs, struct buffer_wait *wait)
|
||||
@ -304,7 +304,10 @@ static inline int sc_is_recv_allowed(const struct stconn *sc)
|
||||
if (sc_ep_test(sc, SE_FL_APPLET_NEED_CONN))
|
||||
return 0;
|
||||
|
||||
return cs_rx_endp_ready(sc) && !cs_rx_blocked(sc);
|
||||
if (sc_ep_test(sc, SE_FL_HAVE_NO_DATA))
|
||||
return 0;
|
||||
|
||||
return !cs_rx_blocked(sc);
|
||||
}
|
||||
|
||||
/* This is to be used after making some room available in a channel. It will
|
||||
@ -325,7 +328,7 @@ static inline void cs_chk_rcv(struct stconn *cs)
|
||||
if (!cs_state_in(cs->state, SC_SB_RDY|SC_SB_EST))
|
||||
return;
|
||||
|
||||
sc_ep_set(cs, SE_FL_RX_WAIT_EP);
|
||||
sc_ep_set(cs, SE_FL_HAVE_NO_DATA);
|
||||
if (likely(cs->app_ops->chk_rcv))
|
||||
cs->app_ops->chk_rcv(cs);
|
||||
}
|
||||
|
@ -1919,7 +1919,7 @@ static int cs_applet_process(struct stconn *cs)
|
||||
/* If the applet wants to write and the channel is closed, it's a
|
||||
* broken pipe and it must be reported.
|
||||
*/
|
||||
if (!sc_ep_test(cs, SE_FL_RX_WAIT_EP) && (ic->flags & CF_SHUTR))
|
||||
if (!sc_ep_test(cs, SE_FL_HAVE_NO_DATA) && (ic->flags & CF_SHUTR))
|
||||
sc_ep_set(cs, SE_FL_ERROR);
|
||||
|
||||
/* automatically mark the applet having data available if it reported
|
||||
|
Loading…
Reference in New Issue
Block a user