diff --git a/include/haproxy/cs_utils.h b/include/haproxy/cs_utils.h index bc864100e..a3a44a9aa 100644 --- a/include/haproxy/cs_utils.h +++ b/include/haproxy/cs_utils.h @@ -31,6 +31,7 @@ #include #include #include +#include /* returns the channel which receives data from this conn-stream (input channel) */ static inline struct channel *cs_ic(struct conn_stream *cs) @@ -227,6 +228,46 @@ static inline void cs_must_kill_conn(struct conn_stream *cs) cs->endp->flags |= CS_EP_KILL_CONN; } + +/* Sends a shutr to the endpoint using the data layer */ +static inline void cs_shutr(struct conn_stream *cs) +{ + cs->ops->shutr(cs); +} + +/* Sends a shutw to the endpoint using the data layer */ +static inline void cs_shutw(struct conn_stream *cs) +{ + cs->ops->shutw(cs); +} + +/* This is to be used after making some room available in a channel. It will + * return without doing anything if the conn-stream's RX path is blocked. + * It will automatically mark the stream interface as busy processing the end + * point in order to avoid useless repeated wakeups. + * It will then call ->chk_rcv() to enable receipt of new data. + */ +static inline void cs_chk_rcv(struct conn_stream *cs) +{ + if (cs->si->flags & SI_FL_RXBLK_CONN && cs_state_in(cs_opposite(cs)->state, CS_SB_RDY|CS_SB_EST|CS_SB_DIS|CS_SB_CLO)) + si_rx_conn_rdy(cs->si); + + if (si_rx_blocked(cs->si) || !si_rx_endp_ready(cs->si)) + return; + + if (!cs_state_in(cs->state, CS_SB_RDY|CS_SB_EST)) + return; + + cs->si->flags |= SI_FL_RX_WAIT_EP; + cs->ops->chk_rcv(cs); +} + +/* Calls chk_snd on the endpoint using the data layer */ +static inline void cs_chk_snd(struct conn_stream *cs) +{ + cs->ops->chk_snd(cs); +} + /* for debugging, reports the stream interface state name */ static inline const char *cs_state_str(int state) { diff --git a/include/haproxy/stream_interface.h b/include/haproxy/stream_interface.h index 3239c059d..211d63ab6 100644 --- a/include/haproxy/stream_interface.h +++ b/include/haproxy/stream_interface.h @@ -27,7 +27,6 @@ #include #include #include -#include #include extern struct cs_app_ops cs_app_embedded_ops; @@ -267,45 +266,6 @@ static inline int si_alloc_ibuf(struct stream_interface *si, struct buffer_wait return ret; } -/* Sends a shutr to the endpoint using the data layer */ -static inline void cs_shutr(struct conn_stream *cs) -{ - cs->ops->shutr(cs); -} - -/* Sends a shutw to the endpoint using the data layer */ -static inline void cs_shutw(struct conn_stream *cs) -{ - cs->ops->shutw(cs); -} - -/* This is to be used after making some room available in a channel. It will - * return without doing anything if the conn-stream's RX path is blocked. - * It will automatically mark the stream interface as busy processing the end - * point in order to avoid useless repeated wakeups. - * It will then call ->chk_rcv() to enable receipt of new data. - */ -static inline void cs_chk_rcv(struct conn_stream *cs) -{ - if (cs->si->flags & SI_FL_RXBLK_CONN && cs_state_in(cs_opposite(cs)->state, CS_SB_RDY|CS_SB_EST|CS_SB_DIS|CS_SB_CLO)) - si_rx_conn_rdy(cs->si); - - if (si_rx_blocked(cs->si) || !si_rx_endp_ready(cs->si)) - return; - - if (!cs_state_in(cs->state, CS_SB_RDY|CS_SB_EST)) - return; - - cs->si->flags |= SI_FL_RX_WAIT_EP; - cs->ops->chk_rcv(cs); -} - -/* Calls chk_snd on the endpoint using the data layer */ -static inline void cs_chk_snd(struct conn_stream *cs) -{ - cs->ops->chk_snd(cs); -} - /* Combines both si_update_rx() and si_update_tx() at once */ static inline void si_update(struct stream_interface *si) { diff --git a/src/conn_stream.c b/src/conn_stream.c index b6b7dfded..892a582b0 100644 --- a/src/conn_stream.c +++ b/src/conn_stream.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include