mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
REORG: conn-stream: Move cs_shut* and cs_chk* in cs_utils
cs_shutr(), cs_shutw(), cs_chk_rcv() and cs_chk_snd() are moved in cs_utils.h
This commit is contained in:
parent
dde33046bd
commit
19bd728642
@ -31,6 +31,7 @@
|
||||
#include <haproxy/conn_stream.h>
|
||||
#include <haproxy/session.h>
|
||||
#include <haproxy/stream.h>
|
||||
#include <haproxy/stream_interface.h>
|
||||
|
||||
/* 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)
|
||||
{
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include <haproxy/channel.h>
|
||||
#include <haproxy/connection.h>
|
||||
#include <haproxy/conn_stream.h>
|
||||
#include <haproxy/cs_utils.h>
|
||||
#include <haproxy/obj_type.h>
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <haproxy/applet.h>
|
||||
#include <haproxy/connection.h>
|
||||
#include <haproxy/conn_stream.h>
|
||||
#include <haproxy/cs_utils.h>
|
||||
#include <haproxy/pool.h>
|
||||
#include <haproxy/stream_interface.h>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user