mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 15:17:01 +02:00
MEDIUM: stream-int/conn-stream: Move blocking flags from SI to CS
Remaining flags and associated functions are move in the conn-stream scope. These flags are added on the endpoint and not the conn-stream itself. This way it will be possible to get them from the mux or the applet. The functions to get or set these flags are renamed accordingly with the "cs_" prefix and updated to manipualte a conn-stream instead of a stream-interface.
This commit is contained in:
parent
ba92787d13
commit
a0bdec350f
@ -1303,7 +1303,7 @@ static int promex_dump_metrics(struct appctx *appctx, struct conn_stream *cs, st
|
||||
return 1;
|
||||
|
||||
full:
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
error:
|
||||
/* unrecoverable error */
|
||||
@ -1448,7 +1448,7 @@ static int promex_send_headers(struct appctx *appctx, struct conn_stream *cs, st
|
||||
return 1;
|
||||
full:
|
||||
htx_reset(htx);
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1478,7 +1478,7 @@ static void promex_appctx_handle_io(struct appctx *appctx)
|
||||
|
||||
/* Check if the input buffer is available. */
|
||||
if (!b_size(&res->buf)) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1519,7 +1519,7 @@ static void promex_appctx_handle_io(struct appctx *appctx)
|
||||
*/
|
||||
if (htx_is_empty(res_htx)) {
|
||||
if (!htx_add_endof(res_htx, HTX_BLK_EOT)) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto out;
|
||||
}
|
||||
channel_add_input(res, 1);
|
||||
|
@ -187,6 +187,15 @@ void show_endp_flags(unsigned int f)
|
||||
printf("0\n");
|
||||
return;
|
||||
}
|
||||
|
||||
SHOW_FLAG(f, CS_EP_RXBLK_CHAN);
|
||||
SHOW_FLAG(f, CS_EP_RXBLK_BUFF);
|
||||
SHOW_FLAG(f, CS_EP_RXBLK_ROOM);
|
||||
SHOW_FLAG(f, CS_EP_RXBLK_SHUT);
|
||||
SHOW_FLAG(f, CS_EP_RXBLK_CONN);
|
||||
SHOW_FLAG(f, CS_EP_RX_WAIT_EP);
|
||||
SHOW_FLAG(f, CS_EP_WANT_GET);
|
||||
SHOW_FLAG(f, CS_EP_WAIT_DATA);
|
||||
SHOW_FLAG(f, CS_EP_KILL_CONN);
|
||||
SHOW_FLAG(f, CS_EP_WAIT_FOR_HS);
|
||||
SHOW_FLAG(f, CS_EP_WANT_ROOM);
|
||||
@ -267,15 +276,7 @@ void show_si_flags(unsigned int f)
|
||||
return;
|
||||
}
|
||||
|
||||
SHOW_FLAG(f, SI_FL_WAIT_DATA);
|
||||
SHOW_FLAG(f, SI_FL_ISBACK);
|
||||
SHOW_FLAG(f, SI_FL_WANT_GET);
|
||||
SHOW_FLAG(f, SI_FL_RXBLK_CHAN);
|
||||
SHOW_FLAG(f, SI_FL_RXBLK_BUFF);
|
||||
SHOW_FLAG(f, SI_FL_RXBLK_ROOM);
|
||||
SHOW_FLAG(f, SI_FL_RXBLK_SHUT);
|
||||
SHOW_FLAG(f, SI_FL_RXBLK_CONN);
|
||||
SHOW_FLAG(f, SI_FL_RX_WAIT_EP);
|
||||
|
||||
if (f) {
|
||||
printf("EXTRA(0x%08x)", f);
|
||||
|
@ -67,13 +67,20 @@ struct stream_interface;
|
||||
CS_EP_RCV_MORE = 0x00080000, /* Endpoint may have more bytes to transfer */
|
||||
CS_EP_WANT_ROOM = 0x00100000, /* More bytes to transfer, but not enough room */
|
||||
|
||||
/* unused: 0x00200000 .. 0x00800000 */
|
||||
|
||||
/* following flags are supposed to be set by the app layer and read by
|
||||
* the endpoint :
|
||||
*/
|
||||
CS_EP_WAIT_FOR_HS = 0x01000000, /* This stream is waiting for handhskae */
|
||||
CS_EP_KILL_CONN = 0x02000000, /* must kill the connection when the CS closes */
|
||||
CS_EP_WAIT_FOR_HS = 0x00200000, /* This stream is waiting for handhskae */
|
||||
CS_EP_KILL_CONN = 0x00400000, /* must kill the connection when the CS closes */
|
||||
CS_EP_WAIT_DATA = 0x00800000, /* CS waits for more outgoing data to send */
|
||||
CS_EP_WANT_GET = 0x01000000, /* CS would like to get some data from the buffer */
|
||||
CS_EP_RX_WAIT_EP = 0x02000000, /* CS waits for more data from the end point */
|
||||
CS_EP_RXBLK_CHAN = 0x04000000, /* the channel doesn't want the CS to introduce data */
|
||||
CS_EP_RXBLK_BUFF = 0x08000000, /* CS waits for a buffer allocation to complete */
|
||||
CS_EP_RXBLK_ROOM = 0x10000000, /* CS waits for more buffer room to store incoming data */
|
||||
CS_EP_RXBLK_SHUT = 0x20000000, /* input is now closed, nothing new will ever come */
|
||||
CS_EP_RXBLK_CONN = 0x40000000, /* other side is not connected */
|
||||
CS_EP_RXBLK_ANY = 0x7C000000, /* any of the RXBLK flags above */
|
||||
};
|
||||
|
||||
/* conn_stream flags */
|
||||
@ -128,7 +135,7 @@ enum cs_state_bit {
|
||||
|
||||
struct conn_stream;
|
||||
|
||||
/* data_cb describes the data layer's recv and send callbacks which are called
|
||||
/* cs_data_cb describes the data layer's recv and send callbacks which are called
|
||||
* when I/O activity was detected after the transport layer is ready. These
|
||||
* callbacks are supposed to make use of the xprt_ops above to exchange data
|
||||
* from/to buffers and pipes. The <wake> callback is used to report activity
|
||||
|
@ -145,8 +145,8 @@ static inline int cs_is_conn_error(const struct conn_stream *cs)
|
||||
* channel_alloc_buffer() for this so it abides by its rules. It returns 0 on
|
||||
* 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 SI_FL_RXBLK_BUFF will be set on the
|
||||
* stream-int and SI_FL_RX_WAIT_EP cleared. The requester will be responsible
|
||||
* waiting for an available buffer, and CS_EP_RXBLK_BUFF will be set on the
|
||||
* stream-int and CS_EP_RX_WAIT_EP cleared. The requester will be responsible
|
||||
* for calling this function to try again once woken up.
|
||||
*/
|
||||
static inline int cs_alloc_ibuf(struct conn_stream *cs, struct buffer_wait *wait)
|
||||
@ -155,7 +155,7 @@ static inline int cs_alloc_ibuf(struct conn_stream *cs, struct buffer_wait *wait
|
||||
|
||||
ret = channel_alloc_buffer(cs_ic(cs), wait);
|
||||
if (!ret)
|
||||
si_rx_buff_blk(cs->si);
|
||||
cs_rx_buff_blk(cs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -289,16 +289,16 @@ static inline void cs_shutw(struct conn_stream *cs)
|
||||
*/
|
||||
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 (cs->endp->flags & CS_EP_RXBLK_CONN && cs_state_in(cs_opposite(cs)->state, CS_SB_RDY|CS_SB_EST|CS_SB_DIS|CS_SB_CLO))
|
||||
cs_rx_conn_rdy(cs);
|
||||
|
||||
if (si_rx_blocked(cs->si) || !si_rx_endp_ready(cs->si))
|
||||
if (cs_rx_blocked(cs) || !cs_rx_endp_ready(cs))
|
||||
return;
|
||||
|
||||
if (!cs_state_in(cs->state, CS_SB_RDY|CS_SB_EST))
|
||||
return;
|
||||
|
||||
cs->si->flags |= SI_FL_RX_WAIT_EP;
|
||||
cs->endp->flags |= CS_EP_RX_WAIT_EP;
|
||||
cs->ops->chk_rcv(cs);
|
||||
}
|
||||
|
||||
|
@ -32,18 +32,7 @@ struct conn_stream;
|
||||
enum {
|
||||
SI_FL_NONE = 0x00000000, /* nothing */
|
||||
/* unused: 0x00000001, 0x00000002 */
|
||||
SI_FL_WAIT_DATA = 0x00000008, /* stream-int waits for more outgoing data to send */
|
||||
SI_FL_ISBACK = 0x00000010, /* 0 for front-side SI, 1 for back-side */
|
||||
/* unused: 0x00000200 */
|
||||
SI_FL_WANT_GET = 0x00004000, /* a stream-int would like to get some data from the buffer */
|
||||
|
||||
SI_FL_RXBLK_CHAN = 0x00010000, /* the channel doesn't want the stream-int to introduce data */
|
||||
SI_FL_RXBLK_BUFF = 0x00020000, /* stream-int waits for a buffer allocation to complete */
|
||||
SI_FL_RXBLK_ROOM = 0x00040000, /* stream-int waits for more buffer room to store incoming data */
|
||||
SI_FL_RXBLK_SHUT = 0x00080000, /* input is now closed, nothing new will ever come */
|
||||
SI_FL_RXBLK_CONN = 0x00100000, /* other side is not connected */
|
||||
SI_FL_RXBLK_ANY = 0x001F0000, /* any of the RXBLK flags above */
|
||||
SI_FL_RX_WAIT_EP = 0x00200000, /* stream-int waits for more data from the end point */
|
||||
};
|
||||
|
||||
/* A stream interface has 3 parts :
|
||||
|
@ -60,137 +60,137 @@ static inline int si_init(struct stream_interface *si)
|
||||
}
|
||||
|
||||
/* Returns non-zero if the stream interface's Rx path is blocked */
|
||||
static inline int si_rx_blocked(const struct stream_interface *si)
|
||||
static inline int cs_rx_blocked(const struct conn_stream *cs)
|
||||
{
|
||||
return !!(si->flags & SI_FL_RXBLK_ANY);
|
||||
return !!(cs->endp->flags & CS_EP_RXBLK_ANY);
|
||||
}
|
||||
|
||||
|
||||
/* Returns non-zero if the stream interface's Rx path is blocked because of lack
|
||||
/* Returns non-zero if the conn-stream's Rx path is blocked because of lack
|
||||
* of room in the input buffer.
|
||||
*/
|
||||
static inline int si_rx_blocked_room(const struct stream_interface *si)
|
||||
static inline int cs_rx_blocked_room(const struct conn_stream *cs)
|
||||
{
|
||||
return !!(si->flags & SI_FL_RXBLK_ROOM);
|
||||
return !!(cs->endp->flags & CS_EP_RXBLK_ROOM);
|
||||
}
|
||||
|
||||
/* Returns non-zero if the stream interface's endpoint is ready to receive */
|
||||
static inline int si_rx_endp_ready(const struct stream_interface *si)
|
||||
/* Returns non-zero if the conn-stream's endpoint is ready to receive */
|
||||
static inline int cs_rx_endp_ready(const struct conn_stream *cs)
|
||||
{
|
||||
return !(si->flags & SI_FL_RX_WAIT_EP);
|
||||
return !(cs->endp->flags & CS_EP_RX_WAIT_EP);
|
||||
}
|
||||
|
||||
/* The stream interface announces it is ready to try to deliver more data to the input buffer */
|
||||
static inline void si_rx_endp_more(struct stream_interface *si)
|
||||
/* The conn-stream announces it is ready to try to deliver more data to the input buffer */
|
||||
static inline void cs_rx_endp_more(struct conn_stream *cs)
|
||||
{
|
||||
si->flags &= ~SI_FL_RX_WAIT_EP;
|
||||
cs->endp->flags &= ~CS_EP_RX_WAIT_EP;
|
||||
}
|
||||
|
||||
/* The stream interface announces it doesn't have more data for the input buffer */
|
||||
static inline void si_rx_endp_done(struct stream_interface *si)
|
||||
/* The conn-stream announces it doesn't have more data for the input buffer */
|
||||
static inline void cs_rx_endp_done(struct conn_stream *cs)
|
||||
{
|
||||
si->flags |= SI_FL_RX_WAIT_EP;
|
||||
cs->endp->flags |= CS_EP_RX_WAIT_EP;
|
||||
}
|
||||
|
||||
/* Tell a stream interface the input channel is OK with it sending it some data */
|
||||
static inline void si_rx_chan_rdy(struct stream_interface *si)
|
||||
/* Tell a conn-stream the input channel is OK with it sending it some data */
|
||||
static inline void cs_rx_chan_rdy(struct conn_stream *cs)
|
||||
{
|
||||
si->flags &= ~SI_FL_RXBLK_CHAN;
|
||||
cs->endp->flags &= ~CS_EP_RXBLK_CHAN;
|
||||
}
|
||||
|
||||
/* Tell a stream interface the input channel is not OK with it sending it some data */
|
||||
static inline void si_rx_chan_blk(struct stream_interface *si)
|
||||
/* Tell a conn-stream the input channel is not OK with it sending it some data */
|
||||
static inline void cs_rx_chan_blk(struct conn_stream *cs)
|
||||
{
|
||||
si->flags |= SI_FL_RXBLK_CHAN;
|
||||
cs->endp->flags |= CS_EP_RXBLK_CHAN;
|
||||
}
|
||||
|
||||
/* Tell a stream interface the other side is connected */
|
||||
static inline void si_rx_conn_rdy(struct stream_interface *si)
|
||||
/* Tell a conn-stream the other side is connected */
|
||||
static inline void cs_rx_conn_rdy(struct conn_stream *cs)
|
||||
{
|
||||
si->flags &= ~SI_FL_RXBLK_CONN;
|
||||
cs->endp->flags &= ~CS_EP_RXBLK_CONN;
|
||||
}
|
||||
|
||||
/* Tell a stream interface it must wait for the other side to connect */
|
||||
static inline void si_rx_conn_blk(struct stream_interface *si)
|
||||
/* Tell a conn-stream it must wait for the other side to connect */
|
||||
static inline void cs_rx_conn_blk(struct conn_stream *cs)
|
||||
{
|
||||
si->flags |= SI_FL_RXBLK_CONN;
|
||||
cs->endp->flags |= CS_EP_RXBLK_CONN;
|
||||
}
|
||||
|
||||
/* The stream interface just got the input buffer it was waiting for */
|
||||
static inline void si_rx_buff_rdy(struct stream_interface *si)
|
||||
/* The conn-stream just got the input buffer it was waiting for */
|
||||
static inline void cs_rx_buff_rdy(struct conn_stream *cs)
|
||||
{
|
||||
si->flags &= ~SI_FL_RXBLK_BUFF;
|
||||
cs->endp->flags &= ~CS_EP_RXBLK_BUFF;
|
||||
}
|
||||
|
||||
/* The stream interface failed to get an input buffer and is waiting for it.
|
||||
/* The conn-stream failed to get an input buffer and is waiting for it.
|
||||
* Since it indicates a willingness to deliver data to the buffer that will
|
||||
* have to be retried, we automatically clear RXBLK_ENDP to be called again
|
||||
* as soon as RXBLK_BUFF is cleared.
|
||||
*/
|
||||
static inline void si_rx_buff_blk(struct stream_interface *si)
|
||||
static inline void cs_rx_buff_blk(struct conn_stream *cs)
|
||||
{
|
||||
si->flags |= SI_FL_RXBLK_BUFF;
|
||||
cs->endp->flags |= CS_EP_RXBLK_BUFF;
|
||||
}
|
||||
|
||||
/* Tell a stream interface some room was made in the input buffer */
|
||||
static inline void si_rx_room_rdy(struct stream_interface *si)
|
||||
/* Tell a conn-stream some room was made in the input buffer */
|
||||
static inline void cs_rx_room_rdy(struct conn_stream *cs)
|
||||
{
|
||||
si->flags &= ~SI_FL_RXBLK_ROOM;
|
||||
cs->endp->flags &= ~CS_EP_RXBLK_ROOM;
|
||||
}
|
||||
|
||||
/* The stream interface announces it failed to put data into the input buffer
|
||||
/* The conn-stream 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, we automatically clear RXBLK_ENDP to
|
||||
* be called again as soon as RXBLK_ROOM is cleared.
|
||||
*/
|
||||
static inline void si_rx_room_blk(struct stream_interface *si)
|
||||
static inline void cs_rx_room_blk(struct conn_stream *cs)
|
||||
{
|
||||
si->flags |= SI_FL_RXBLK_ROOM;
|
||||
cs->endp->flags |= CS_EP_RXBLK_ROOM;
|
||||
}
|
||||
|
||||
/* The stream interface announces it will never put new data into the input
|
||||
/* The conn-stream announces it will never put new data into the input
|
||||
* buffer and that it's not waiting for its endpoint to deliver anything else.
|
||||
* This function obviously doesn't have a _rdy equivalent.
|
||||
*/
|
||||
static inline void si_rx_shut_blk(struct stream_interface *si)
|
||||
static inline void cs_rx_shut_blk(struct conn_stream *cs)
|
||||
{
|
||||
si->flags |= SI_FL_RXBLK_SHUT;
|
||||
cs->endp->flags |= CS_EP_RXBLK_SHUT;
|
||||
}
|
||||
|
||||
/* Returns non-zero if the stream interface's Rx path is blocked */
|
||||
static inline int si_tx_blocked(const struct stream_interface *si)
|
||||
/* Returns non-zero if the conn-stream's Tx path is blocked */
|
||||
static inline int cs_tx_blocked(const struct conn_stream *cs)
|
||||
{
|
||||
return !!(si->flags & SI_FL_WAIT_DATA);
|
||||
return !!(cs->endp->flags & CS_EP_WAIT_DATA);
|
||||
}
|
||||
|
||||
/* Returns non-zero if the stream interface's endpoint is ready to transmit */
|
||||
static inline int si_tx_endp_ready(const struct stream_interface *si)
|
||||
/* Returns non-zero if the conn-stream's endpoint is ready to transmit */
|
||||
static inline int cs_tx_endp_ready(const struct conn_stream *cs)
|
||||
{
|
||||
return (si->flags & SI_FL_WANT_GET);
|
||||
return (cs->endp->flags & CS_EP_WANT_GET);
|
||||
}
|
||||
|
||||
/* Report that a stream interface wants to get some data from the output buffer */
|
||||
static inline void si_want_get(struct stream_interface *si)
|
||||
/* Report that a conn-stream wants to get some data from the output buffer */
|
||||
static inline void cs_want_get(struct conn_stream *cs)
|
||||
{
|
||||
si->flags |= SI_FL_WANT_GET;
|
||||
cs->endp->flags |= CS_EP_WANT_GET;
|
||||
}
|
||||
|
||||
/* Report that a stream interface failed to get some data from the output buffer */
|
||||
static inline void si_cant_get(struct stream_interface *si)
|
||||
/* Report that a conn-stream failed to get some data from the output buffer */
|
||||
static inline void cs_cant_get(struct conn_stream *cs)
|
||||
{
|
||||
si->flags |= SI_FL_WANT_GET | SI_FL_WAIT_DATA;
|
||||
cs->endp->flags |= CS_EP_WANT_GET | CS_EP_WAIT_DATA;
|
||||
}
|
||||
|
||||
/* Report that a stream interface doesn't want to get data from the output buffer */
|
||||
static inline void si_stop_get(struct stream_interface *si)
|
||||
/* Report that a conn-stream doesn't want to get data from the output buffer */
|
||||
static inline void cs_stop_get(struct conn_stream *cs)
|
||||
{
|
||||
si->flags &= ~SI_FL_WANT_GET;
|
||||
cs->endp->flags &= ~CS_EP_WANT_GET;
|
||||
}
|
||||
|
||||
/* Report that a stream interface won't get any more data from the output buffer */
|
||||
static inline void si_done_get(struct stream_interface *si)
|
||||
/* Report that a conn-stream won't get any more data from the output buffer */
|
||||
static inline void cs_done_get(struct conn_stream *cs)
|
||||
{
|
||||
si->flags &= ~(SI_FL_WANT_GET | SI_FL_WAIT_DATA);
|
||||
cs->endp->flags &= ~(CS_EP_WANT_GET | CS_EP_WAIT_DATA);
|
||||
}
|
||||
|
||||
#endif /* _HAPROXY_STREAM_INTERFACE_H */
|
||||
|
@ -640,7 +640,7 @@ static int cli_io_handler_show_profiling(struct appctx *appctx)
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
/* failed, try again */
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -690,14 +690,14 @@ static int cli_io_handler_show_profiling(struct appctx *appctx)
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
/* failed, try again */
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
/* failed, try again */
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -754,13 +754,13 @@ static int cli_io_handler_show_profiling(struct appctx *appctx)
|
||||
chunk_appendf(&trash, "\n");
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -781,7 +781,7 @@ static int cli_io_handler_show_profiling(struct appctx *appctx)
|
||||
tot_alloc_bytes - tot_free_bytes);
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -968,7 +968,7 @@ static int cli_io_handler_show_tasks(struct appctx *appctx)
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
/* failed, try again */
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
20
src/applet.c
20
src/applet.c
@ -105,10 +105,10 @@ int appctx_buf_available(void *arg)
|
||||
struct conn_stream *cs = appctx->owner;
|
||||
|
||||
/* allocation requested ? */
|
||||
if (!(cs->si->flags & SI_FL_RXBLK_BUFF))
|
||||
if (!(cs->endp->flags & CS_EP_RXBLK_BUFF))
|
||||
return 0;
|
||||
|
||||
si_rx_buff_rdy(cs->si);
|
||||
cs_rx_buff_rdy(cs);
|
||||
|
||||
/* was already allocated another way ? if so, don't take this one */
|
||||
if (c_size(cs_ic(cs)) || cs_ic(cs)->pipe)
|
||||
@ -116,7 +116,7 @@ int appctx_buf_available(void *arg)
|
||||
|
||||
/* allocation possible now ? */
|
||||
if (!b_alloc(&cs_ic(cs)->buf)) {
|
||||
si_rx_buff_blk(cs->si);
|
||||
cs_rx_buff_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -141,8 +141,8 @@ struct task *task_run_applet(struct task *t, void *context, unsigned int state)
|
||||
* put, it's up to it to change this if needed. This ensures
|
||||
* that one applet which ignores any event will not spin.
|
||||
*/
|
||||
si_cant_get(cs->si);
|
||||
si_rx_endp_done(cs->si);
|
||||
cs_cant_get(cs);
|
||||
cs_rx_endp_done(cs);
|
||||
|
||||
/* Now we'll try to allocate the input buffer. We wake up the applet in
|
||||
* all cases. So this is the applet's responsibility to check if this
|
||||
@ -151,7 +151,7 @@ struct task *task_run_applet(struct task *t, void *context, unsigned int state)
|
||||
* do if it needs the buffer, it will be called again upon readiness.
|
||||
*/
|
||||
if (!cs_alloc_ibuf(cs, &app->buffer_wait))
|
||||
si_rx_endp_more(cs->si);
|
||||
cs_rx_endp_more(cs);
|
||||
|
||||
count = co_data(cs_oc(cs));
|
||||
app->applet->fct(app);
|
||||
@ -161,15 +161,15 @@ struct task *task_run_applet(struct task *t, void *context, unsigned int state)
|
||||
*/
|
||||
if (count != co_data(cs_oc(cs))) {
|
||||
cs_oc(cs)->flags |= CF_WRITE_PARTIAL | CF_WROTE_DATA;
|
||||
si_rx_room_rdy(cs_opposite(cs)->si);
|
||||
cs_rx_room_rdy(cs_opposite(cs));
|
||||
}
|
||||
|
||||
/* measure the call rate and check for anomalies when too high */
|
||||
rate = update_freq_ctr(&app->call_rate, 1);
|
||||
if (rate >= 100000 && app->call_rate.prev_ctr && // looped more than 100k times over last second
|
||||
((b_size(cs_ib(cs)) && cs->si->flags & SI_FL_RXBLK_BUFF) || // asks for a buffer which is present
|
||||
(b_size(cs_ib(cs)) && !b_data(cs_ib(cs)) && cs->si->flags & SI_FL_RXBLK_ROOM) || // asks for room in an empty buffer
|
||||
(b_data(cs_ob(cs)) && si_tx_endp_ready(cs->si) && !si_tx_blocked(cs->si)) || // asks for data already present
|
||||
((b_size(cs_ib(cs)) && cs->endp->flags & CS_EP_RXBLK_BUFF) || // asks for a buffer which is present
|
||||
(b_size(cs_ib(cs)) && !b_data(cs_ib(cs)) && cs->endp->flags & CS_EP_RXBLK_ROOM) || // asks for room in an empty buffer
|
||||
(b_data(cs_ob(cs)) && cs_tx_endp_ready(cs) && !cs_tx_blocked(cs)) || // asks for data already present
|
||||
(!b_data(cs_ib(cs)) && b_data(cs_ob(cs)) && // didn't return anything ...
|
||||
(cs_oc(cs)->flags & (CF_WRITE_PARTIAL|CF_SHUTW_NOW)) == CF_SHUTW_NOW))) { // ... and left data pending after a shut
|
||||
stream_dump_and_crash(&app->obj_type, read_freq_ctr(&app->call_rate));
|
||||
|
@ -1447,7 +1447,7 @@ static void http_cache_io_handler(struct appctx *appctx)
|
||||
|
||||
/* Check if the input buffer is available. */
|
||||
if (!b_size(&res->buf)) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1492,7 +1492,7 @@ static void http_cache_io_handler(struct appctx *appctx)
|
||||
if (len) {
|
||||
ret = htx_cache_dump_msg(appctx, res_htx, len, HTX_BLK_UNUSED);
|
||||
if (ret < len) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@ -2583,7 +2583,7 @@ static int cli_io_handler_show_cache(struct appctx *appctx)
|
||||
if (!next_key) {
|
||||
chunk_printf(&trash, "%p: %s (shctx:%p, available blocks:%d)\n", cache, cache->id, shctx_ptr(cache), shctx_ptr(cache)->nbav);
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -2621,7 +2621,7 @@ static int cli_io_handler_show_cache(struct appctx *appctx)
|
||||
shctx_unlock(shctx_ptr(cache));
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
16
src/cli.c
16
src/cli.c
@ -930,7 +930,7 @@ static void cli_io_handler(struct appctx *appctx)
|
||||
* would want to return some info right after parsing.
|
||||
*/
|
||||
if (buffer_almost_full(cs_ib(cs))) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1070,7 +1070,7 @@ static void cli_io_handler(struct appctx *appctx)
|
||||
appctx->st0 = CLI_ST_PROMPT;
|
||||
}
|
||||
else
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
break;
|
||||
|
||||
case CLI_ST_CALLBACK: /* use custom pointer */
|
||||
@ -1110,7 +1110,7 @@ static void cli_io_handler(struct appctx *appctx)
|
||||
if (ci_putstr(cs_ic(cs), prompt) != -1)
|
||||
appctx->st0 = CLI_ST_GETREQ;
|
||||
else
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
}
|
||||
|
||||
/* If the output functions are still there, it means they require more room. */
|
||||
@ -1214,7 +1214,7 @@ static int cli_io_handler_show_env(struct appctx *appctx)
|
||||
chunk_printf(&trash, "%s\n", *var);
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
if (appctx->st2 == STAT_ST_END)
|
||||
@ -1406,7 +1406,7 @@ static int cli_io_handler_show_fd(struct appctx *appctx)
|
||||
chunk_appendf(&trash, "%s\n", suspicious ? " !" : "");
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
appctx->ctx.cli.i0 = fd;
|
||||
ret = 0;
|
||||
break;
|
||||
@ -1520,7 +1520,7 @@ static int cli_io_handler_show_activity(struct appctx *appctx)
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
chunk_reset(&trash);
|
||||
chunk_printf(&trash, "[output too large, cannot dump]\n");
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
}
|
||||
|
||||
#undef SHOW_AVG
|
||||
@ -1544,7 +1544,7 @@ static int cli_io_handler_show_cli_sock(struct appctx *appctx)
|
||||
case STAT_ST_INIT:
|
||||
chunk_printf(&trash, "# socket lvl processes\n");
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
appctx->st2 = STAT_ST_LIST;
|
||||
@ -1606,7 +1606,7 @@ static int cli_io_handler_show_cli_sock(struct appctx *appctx)
|
||||
chunk_appendf(&trash, "all\n");
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ struct appctx *cs_register_applet(struct conn_stream *cs, struct applet *app)
|
||||
cs_attach_applet(cs, appctx, appctx);
|
||||
appctx->owner = cs;
|
||||
appctx->t->nice = __cs_strm(cs)->task->nice;
|
||||
si_cant_get(cs->si);
|
||||
cs_cant_get(cs);
|
||||
appctx_wakeup(appctx);
|
||||
return appctx;
|
||||
}
|
||||
@ -443,7 +443,7 @@ static void cs_app_shutr(struct conn_stream *cs)
|
||||
{
|
||||
struct channel *ic = cs_ic(cs);
|
||||
|
||||
si_rx_shut_blk(cs->si);
|
||||
cs_rx_shut_blk(cs);
|
||||
if (ic->flags & CF_SHUTR)
|
||||
return;
|
||||
ic->flags |= CF_SHUTR;
|
||||
@ -483,7 +483,7 @@ static void cs_app_shutw(struct conn_stream *cs)
|
||||
return;
|
||||
oc->flags |= CF_SHUTW;
|
||||
oc->wex = TICK_ETERNITY;
|
||||
si_done_get(cs->si);
|
||||
cs_done_get(cs);
|
||||
|
||||
if (tick_isset(cs->hcto)) {
|
||||
ic->rto = cs->hcto;
|
||||
@ -513,7 +513,7 @@ static void cs_app_shutw(struct conn_stream *cs)
|
||||
/* fall through */
|
||||
default:
|
||||
cs->flags &= ~CS_FL_NOLINGER;
|
||||
si_rx_shut_blk(cs->si);
|
||||
cs_rx_shut_blk(cs);
|
||||
ic->flags |= CF_SHUTR;
|
||||
ic->rex = TICK_ETERNITY;
|
||||
__cs_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
@ -535,7 +535,7 @@ static void cs_app_chk_rcv(struct conn_stream *cs)
|
||||
|
||||
if (ic->pipe) {
|
||||
/* stop reading */
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
}
|
||||
else {
|
||||
/* (re)start reading */
|
||||
@ -556,14 +556,14 @@ static void cs_app_chk_snd(struct conn_stream *cs)
|
||||
if (unlikely(cs->state != CS_ST_EST || (oc->flags & CF_SHUTW)))
|
||||
return;
|
||||
|
||||
if (!(cs->si->flags & SI_FL_WAIT_DATA) || /* not waiting for data */
|
||||
if (!(cs->endp->flags & CS_EP_WAIT_DATA) || /* not waiting for data */
|
||||
channel_is_empty(oc)) /* called with nothing to send ! */
|
||||
return;
|
||||
|
||||
/* Otherwise there are remaining data to be sent in the buffer,
|
||||
* so we tell the handler.
|
||||
*/
|
||||
cs->si->flags &= ~SI_FL_WAIT_DATA;
|
||||
cs->endp->flags &= ~CS_EP_WAIT_DATA;
|
||||
if (!tick_isset(oc->wex))
|
||||
oc->wex = tick_add_ifset(now_ms, oc->wto);
|
||||
|
||||
@ -587,7 +587,7 @@ static void cs_app_shutr_conn(struct conn_stream *cs)
|
||||
|
||||
BUG_ON(!cs_conn(cs));
|
||||
|
||||
si_rx_shut_blk(cs->si);
|
||||
cs_rx_shut_blk(cs);
|
||||
if (ic->flags & CF_SHUTR)
|
||||
return;
|
||||
ic->flags |= CF_SHUTR;
|
||||
@ -627,7 +627,7 @@ static void cs_app_shutw_conn(struct conn_stream *cs)
|
||||
return;
|
||||
oc->flags |= CF_SHUTW;
|
||||
oc->wex = TICK_ETERNITY;
|
||||
si_done_get(cs->si);
|
||||
cs_done_get(cs);
|
||||
|
||||
if (tick_isset(cs->hcto)) {
|
||||
ic->rto = cs->hcto;
|
||||
@ -682,7 +682,7 @@ static void cs_app_shutw_conn(struct conn_stream *cs)
|
||||
/* fall through */
|
||||
default:
|
||||
cs->flags &= ~CS_FL_NOLINGER;
|
||||
si_rx_shut_blk(cs->si);
|
||||
cs_rx_shut_blk(cs);
|
||||
ic->flags |= CF_SHUTR;
|
||||
ic->rex = TICK_ETERNITY;
|
||||
__cs_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
@ -724,7 +724,7 @@ static void cs_app_chk_snd_conn(struct conn_stream *cs)
|
||||
return;
|
||||
|
||||
if (!oc->pipe && /* spliced data wants to be forwarded ASAP */
|
||||
!(cs->si->flags & SI_FL_WAIT_DATA)) /* not waiting for data */
|
||||
!(cs->endp->flags & CS_EP_WAIT_DATA)) /* not waiting for data */
|
||||
return;
|
||||
|
||||
if (!(cs->wait_event.events & SUB_RETRY_SEND) && !channel_is_empty(cs_oc(cs)))
|
||||
@ -754,14 +754,14 @@ static void cs_app_chk_snd_conn(struct conn_stream *cs)
|
||||
}
|
||||
|
||||
if ((oc->flags & (CF_SHUTW|CF_SHUTW_NOW)) == 0)
|
||||
cs->si->flags |= SI_FL_WAIT_DATA;
|
||||
cs->endp->flags |= CS_EP_WAIT_DATA;
|
||||
oc->wex = TICK_ETERNITY;
|
||||
}
|
||||
else {
|
||||
/* Otherwise there are remaining data to be sent in the buffer,
|
||||
* which means we have to poll before doing so.
|
||||
*/
|
||||
cs->si->flags &= ~SI_FL_WAIT_DATA;
|
||||
cs->endp->flags &= ~CS_EP_WAIT_DATA;
|
||||
if (!tick_isset(oc->wex))
|
||||
oc->wex = tick_add_ifset(now_ms, oc->wto);
|
||||
}
|
||||
@ -814,7 +814,7 @@ static void cs_app_shutr_applet(struct conn_stream *cs)
|
||||
|
||||
BUG_ON(!cs_appctx(cs));
|
||||
|
||||
si_rx_shut_blk(cs->si);
|
||||
cs_rx_shut_blk(cs);
|
||||
if (ic->flags & CF_SHUTR)
|
||||
return;
|
||||
ic->flags |= CF_SHUTR;
|
||||
@ -855,7 +855,7 @@ static void cs_app_shutw_applet(struct conn_stream *cs)
|
||||
return;
|
||||
oc->flags |= CF_SHUTW;
|
||||
oc->wex = TICK_ETERNITY;
|
||||
si_done_get(cs->si);
|
||||
cs_done_get(cs);
|
||||
|
||||
if (tick_isset(cs->hcto)) {
|
||||
ic->rto = cs->hcto;
|
||||
@ -889,7 +889,7 @@ static void cs_app_shutw_applet(struct conn_stream *cs)
|
||||
/* fall through */
|
||||
default:
|
||||
cs->flags &= ~CS_FL_NOLINGER;
|
||||
si_rx_shut_blk(cs->si);
|
||||
cs_rx_shut_blk(cs);
|
||||
ic->flags |= CF_SHUTR;
|
||||
ic->rex = TICK_ETERNITY;
|
||||
__cs_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
@ -929,7 +929,7 @@ static void cs_app_chk_snd_applet(struct conn_stream *cs)
|
||||
|
||||
/* we only wake the applet up if it was waiting for some data */
|
||||
|
||||
if (!(cs->si->flags & SI_FL_WAIT_DATA))
|
||||
if (!(cs->endp->flags & CS_EP_WAIT_DATA))
|
||||
return;
|
||||
|
||||
if (!tick_isset(oc->wex))
|
||||
@ -956,19 +956,19 @@ void cs_update_rx(struct conn_stream *cs)
|
||||
struct channel *ic = cs_ic(cs);
|
||||
|
||||
if (ic->flags & CF_SHUTR) {
|
||||
si_rx_shut_blk(cs->si);
|
||||
cs_rx_shut_blk(cs);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Read not closed, update FD status and timeout for reads */
|
||||
if (ic->flags & CF_DONT_READ)
|
||||
si_rx_chan_blk(cs->si);
|
||||
cs_rx_chan_blk(cs);
|
||||
else
|
||||
si_rx_chan_rdy(cs->si);
|
||||
cs_rx_chan_rdy(cs);
|
||||
|
||||
if (!channel_is_empty(ic) || !channel_may_recv(ic)) {
|
||||
/* stop reading, imposed by channel's policy or contents */
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
}
|
||||
else {
|
||||
/* (re)start reading and update timeout. Note: we don't recompute the timeout
|
||||
@ -976,9 +976,9 @@ void cs_update_rx(struct conn_stream *cs)
|
||||
* update it if is was not yet set. The stream socket handler will already
|
||||
* have updated it if there has been a completed I/O.
|
||||
*/
|
||||
si_rx_room_rdy(cs->si);
|
||||
cs_rx_room_rdy(cs);
|
||||
}
|
||||
if (cs->si->flags & SI_FL_RXBLK_ANY & ~SI_FL_RX_WAIT_EP)
|
||||
if (cs->endp->flags & CS_EP_RXBLK_ANY & ~CS_EP_RX_WAIT_EP)
|
||||
ic->rex = TICK_ETERNITY;
|
||||
else if (!(ic->flags & CF_READ_NOEXP) && !tick_isset(ic->rex))
|
||||
ic->rex = tick_add_ifset(now_ms, ic->rto);
|
||||
@ -1006,9 +1006,9 @@ void cs_update_tx(struct conn_stream *cs)
|
||||
/* Write not closed, update FD status and timeout for writes */
|
||||
if (channel_is_empty(oc)) {
|
||||
/* stop writing */
|
||||
if (!(cs->si->flags & SI_FL_WAIT_DATA)) {
|
||||
if (!(cs->endp->flags & CS_EP_WAIT_DATA)) {
|
||||
if ((oc->flags & CF_SHUTW_NOW) == 0)
|
||||
cs->si->flags |= SI_FL_WAIT_DATA;
|
||||
cs->endp->flags |= CS_EP_WAIT_DATA;
|
||||
oc->wex = TICK_ETERNITY;
|
||||
}
|
||||
return;
|
||||
@ -1019,7 +1019,7 @@ void cs_update_tx(struct conn_stream *cs)
|
||||
* update it if is was not yet set. The stream socket handler will already
|
||||
* have updated it if there has been a completed I/O.
|
||||
*/
|
||||
cs->si->flags &= ~SI_FL_WAIT_DATA;
|
||||
cs->endp->flags &= ~CS_EP_WAIT_DATA;
|
||||
if (!tick_isset(oc->wex)) {
|
||||
oc->wex = tick_add_ifset(now_ms, oc->wto);
|
||||
if (tick_isset(ic->rex) && !(cs->flags & CS_FL_INDEP_STR)) {
|
||||
|
@ -306,7 +306,7 @@ static int cli_io_handler_show_threads(struct appctx *appctx)
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
/* failed, try again */
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
appctx->st1 = thr;
|
||||
return 0;
|
||||
}
|
||||
@ -1174,7 +1174,7 @@ static int debug_iohandler_fd(struct appctx *appctx)
|
||||
chunk_appendf(&trash, "\n");
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
appctx->ctx.cli.i0 = fd;
|
||||
ret = 0;
|
||||
break;
|
||||
@ -1274,7 +1274,7 @@ static int debug_iohandler_memstats(struct appctx *appctx)
|
||||
(unsigned long)(ptr->calls ? (ptr->size / ptr->calls) : 0));
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
appctx->ctx.cli.p0 = ptr;
|
||||
ret = 0;
|
||||
break;
|
||||
|
16
src/dns.c
16
src/dns.c
@ -443,9 +443,9 @@ static void dns_session_io_handler(struct appctx *appctx)
|
||||
* to be notified whenever the connection completes.
|
||||
*/
|
||||
if (cs_opposite(cs)->state < CS_ST_EST) {
|
||||
si_cant_get(cs->si);
|
||||
si_rx_conn_blk(cs->si);
|
||||
si_rx_endp_more(cs->si);
|
||||
cs_cant_get(cs);
|
||||
cs_rx_conn_blk(cs);
|
||||
cs_rx_endp_more(cs);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -507,7 +507,7 @@ static void dns_session_io_handler(struct appctx *appctx)
|
||||
|
||||
/* check if there is enough room to put message len and query id */
|
||||
if (available_room < sizeof(slen) + sizeof(new_qid)) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
@ -565,7 +565,7 @@ static void dns_session_io_handler(struct appctx *appctx)
|
||||
|
||||
/* check if it remains available room on output chan */
|
||||
if (unlikely(!available_room)) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
@ -593,7 +593,7 @@ static void dns_session_io_handler(struct appctx *appctx)
|
||||
* check available_room is large
|
||||
* enough here.
|
||||
*/
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
@ -601,7 +601,7 @@ static void dns_session_io_handler(struct appctx *appctx)
|
||||
if (ds->tx_msg_offset) {
|
||||
/* msg was not fully processed, we must be awake to drain pending data */
|
||||
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
@ -621,7 +621,7 @@ static void dns_session_io_handler(struct appctx *appctx)
|
||||
BUG_ON(LIST_INLIST(&appctx->wait_entry));
|
||||
LIST_APPEND(&ring->waiters, &appctx->wait_entry);
|
||||
HA_RWLOCK_WRUNLOCK(DNS_LOCK, &ring->lock);
|
||||
si_rx_endp_done(cs->si);
|
||||
cs_rx_endp_done(cs);
|
||||
}
|
||||
|
||||
read:
|
||||
|
@ -1148,7 +1148,7 @@ spoe_send_frame(struct appctx *appctx, char *buf, size_t framesz)
|
||||
ret = ci_putblk(cs_ic(cs), buf, framesz+4);
|
||||
if (ret <= 0) {
|
||||
if ((ret == -3 && b_is_null(&cs_ic(cs)->buf)) || ret == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 1; /* retry */
|
||||
}
|
||||
SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_IO;
|
||||
@ -1192,8 +1192,8 @@ spoe_recv_frame(struct appctx *appctx, char *buf, size_t framesz)
|
||||
static int
|
||||
spoe_wakeup_appctx(struct appctx *appctx)
|
||||
{
|
||||
si_want_get(cs_si(appctx->owner));
|
||||
si_rx_endp_more(cs_si(appctx->owner));
|
||||
cs_want_get(appctx->owner);
|
||||
cs_rx_endp_more(appctx->owner);
|
||||
appctx_wakeup(appctx);
|
||||
return 1;
|
||||
}
|
||||
@ -1352,7 +1352,7 @@ spoe_handle_connect_appctx(struct appctx *appctx)
|
||||
|
||||
if (!cs_state_in(cs->state, CS_SB_RDY|CS_SB_EST)) {
|
||||
/* not connected yet */
|
||||
si_rx_endp_more(cs->si);
|
||||
cs_rx_endp_more(cs);
|
||||
task_wakeup(__cs_strm(cs)->task, TASK_WOKEN_MSG);
|
||||
goto stop;
|
||||
}
|
||||
@ -2034,7 +2034,7 @@ spoe_create_appctx(struct spoe_config *conf)
|
||||
stream_set_backend(strm, conf->agent->b.be);
|
||||
|
||||
/* applet is waiting for data */
|
||||
si_cant_get(cs_si(strm->csf));
|
||||
cs_cant_get(strm->csf);
|
||||
appctx_wakeup(appctx);
|
||||
|
||||
strm->do_log = NULL;
|
||||
|
44
src/hlua.c
44
src/hlua.c
@ -1932,9 +1932,9 @@ static void hlua_socket_handler(struct appctx *appctx)
|
||||
* to be notified whenever the connection completes.
|
||||
*/
|
||||
if (cs_opposite(cs)->state < CS_ST_EST) {
|
||||
si_cant_get(cs->si);
|
||||
si_rx_conn_blk(cs->si);
|
||||
si_rx_endp_more(cs->si);
|
||||
cs_cant_get(cs);
|
||||
cs_rx_conn_blk(cs);
|
||||
cs_rx_endp_more(cs);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1959,7 +1959,7 @@ static void hlua_socket_handler(struct appctx *appctx)
|
||||
* to write, so we clear the blocking flag.
|
||||
*/
|
||||
if (notification_registered(&appctx->ctx.hlua_cosocket.wake_on_write))
|
||||
si_rx_endp_more(cs->si);
|
||||
cs_rx_endp_more(cs);
|
||||
}
|
||||
|
||||
/* This function is called when the "struct stream" is destroyed.
|
||||
@ -2792,8 +2792,8 @@ __LJMP static int hlua_socket_connect(struct lua_State *L)
|
||||
/* inform the stream that we want to be notified whenever the
|
||||
* connection completes.
|
||||
*/
|
||||
si_cant_get(cs_si(s->csf));
|
||||
si_rx_endp_more(cs_si(s->csf));
|
||||
cs_cant_get(s->csf);
|
||||
cs_rx_endp_more(s->csf);
|
||||
appctx_wakeup(appctx);
|
||||
|
||||
hlua->gc_count++;
|
||||
@ -4452,7 +4452,7 @@ __LJMP static int hlua_applet_tcp_getline_yield(lua_State *L, int status, lua_KC
|
||||
|
||||
/* Data not yet available. return yield. */
|
||||
if (ret == 0) {
|
||||
si_cant_get(cs->si);
|
||||
cs_cant_get(cs);
|
||||
MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_tcp_getline_yield, TICK_ETERNITY, 0));
|
||||
}
|
||||
|
||||
@ -4507,7 +4507,7 @@ __LJMP static int hlua_applet_tcp_recv_yield(lua_State *L, int status, lua_KCont
|
||||
|
||||
/* Data not yet available. return yield. */
|
||||
if (ret == 0) {
|
||||
si_cant_get(cs->si);
|
||||
cs_cant_get(cs);
|
||||
MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_tcp_recv_yield, TICK_ETERNITY, 0));
|
||||
}
|
||||
|
||||
@ -4530,7 +4530,7 @@ __LJMP static int hlua_applet_tcp_recv_yield(lua_State *L, int status, lua_KCont
|
||||
luaL_addlstring(&luactx->b, blk1, len1);
|
||||
luaL_addlstring(&luactx->b, blk2, len2);
|
||||
co_skip(cs_oc(cs), len1 + len2);
|
||||
si_cant_get(cs->si);
|
||||
cs_cant_get(cs);
|
||||
MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_tcp_recv_yield, TICK_ETERNITY, 0));
|
||||
|
||||
} else {
|
||||
@ -4554,7 +4554,7 @@ __LJMP static int hlua_applet_tcp_recv_yield(lua_State *L, int status, lua_KCont
|
||||
if (len > 0) {
|
||||
lua_pushinteger(L, len);
|
||||
lua_replace(L, 2);
|
||||
si_cant_get(cs->si);
|
||||
cs_cant_get(cs);
|
||||
MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_tcp_recv_yield, TICK_ETERNITY, 0));
|
||||
}
|
||||
|
||||
@ -4623,7 +4623,7 @@ __LJMP static int hlua_applet_tcp_send_yield(lua_State *L, int status, lua_KCont
|
||||
* applet, and returns a yield.
|
||||
*/
|
||||
if (l < len) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_tcp_send_yield, TICK_ETERNITY, 0));
|
||||
}
|
||||
|
||||
@ -4993,7 +4993,7 @@ __LJMP static int hlua_applet_http_getline_yield(lua_State *L, int status, lua_K
|
||||
|
||||
htx_to_buf(htx, &req->buf);
|
||||
if (!stop) {
|
||||
si_cant_get(cs->si);
|
||||
cs_cant_get(cs);
|
||||
MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_http_getline_yield, TICK_ETERNITY, 0));
|
||||
}
|
||||
|
||||
@ -5091,7 +5091,7 @@ __LJMP static int hlua_applet_http_recv_yield(lua_State *L, int status, lua_KCon
|
||||
lua_pushinteger(L, len);
|
||||
lua_replace(L, 2);
|
||||
}
|
||||
si_cant_get(cs->si);
|
||||
cs_cant_get(cs);
|
||||
MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_http_recv_yield, TICK_ETERNITY, 0));
|
||||
}
|
||||
|
||||
@ -5163,7 +5163,7 @@ __LJMP static int hlua_applet_http_send_yield(lua_State *L, int status, lua_KCon
|
||||
if (l < len) {
|
||||
snd_yield:
|
||||
htx_to_buf(htx, &res->buf);
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_http_send_yield, TICK_ETERNITY, 0));
|
||||
}
|
||||
|
||||
@ -5467,7 +5467,7 @@ __LJMP static int hlua_applet_http_start_response_yield(lua_State *L, int status
|
||||
struct channel *res = cs_ic(cs);
|
||||
|
||||
if (co_data(res)) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_http_start_response_yield, TICK_ETERNITY, 0));
|
||||
}
|
||||
return MAY_LJMP(hlua_applet_http_send_response(L));
|
||||
@ -9261,8 +9261,8 @@ static int hlua_applet_tcp_init(struct appctx *ctx)
|
||||
RESET_SAFE_LJMP(hlua);
|
||||
|
||||
/* Wakeup the applet ASAP. */
|
||||
si_cant_get(cs->si);
|
||||
si_rx_endp_more(cs->si);
|
||||
cs_cant_get(cs);
|
||||
cs_rx_endp_more(cs);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -9455,7 +9455,7 @@ static int hlua_applet_http_init(struct appctx *ctx)
|
||||
RESET_SAFE_LJMP(hlua);
|
||||
|
||||
/* Wakeup the applet when data is ready for read. */
|
||||
si_cant_get(cs->si);
|
||||
cs_cant_get(cs);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -9479,7 +9479,7 @@ void hlua_applet_http_fct(struct appctx *ctx)
|
||||
|
||||
/* Check if the input buffer is available. */
|
||||
if (!b_size(&res->buf)) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto out;
|
||||
}
|
||||
/* check that the output is not closed */
|
||||
@ -9490,7 +9490,7 @@ void hlua_applet_http_fct(struct appctx *ctx)
|
||||
if (!HLUA_IS_RUNNING(hlua) &&
|
||||
!(ctx->ctx.hlua_apphttp.flags & APPLET_DONE)) {
|
||||
if (!co_data(req)) {
|
||||
si_cant_get(cs->si);
|
||||
cs_cant_get(cs);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@ -9559,7 +9559,7 @@ void hlua_applet_http_fct(struct appctx *ctx)
|
||||
*/
|
||||
if (htx_is_empty(res_htx) && (strm->txn->rsp.flags & (HTTP_MSGF_XFER_LEN|HTTP_MSGF_CNT_LEN)) == HTTP_MSGF_XFER_LEN) {
|
||||
if (!htx_add_endof(res_htx, HTX_BLK_EOT)) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto out;
|
||||
}
|
||||
channel_add_input(res, 1);
|
||||
@ -10113,7 +10113,7 @@ static int hlua_cli_io_handler_fct(struct appctx *appctx)
|
||||
case HLUA_E_AGAIN:
|
||||
/* We want write. */
|
||||
if (HLUA_IS_WAKERESWR(hlua))
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
/* Set the timeout. */
|
||||
if (hlua->wake_time != TICK_ETERNITY)
|
||||
task_schedule(hlua->task, hlua->wake_time);
|
||||
|
@ -1247,7 +1247,7 @@ static __inline int do_l7_retry(struct stream *s, struct stream_interface *si)
|
||||
req->flags &= ~(CF_WRITE_ERROR | CF_WRITE_TIMEOUT | CF_SHUTW | CF_SHUTW_NOW);
|
||||
res->flags &= ~(CF_READ_ERROR | CF_READ_TIMEOUT | CF_SHUTR | CF_EOI | CF_READ_NULL | CF_SHUTR_NOW);
|
||||
res->analysers &= AN_RES_FLT_END;
|
||||
si->flags &= ~SI_FL_RXBLK_SHUT;
|
||||
si->cs->endp->flags &= ~CS_EP_RXBLK_SHUT;
|
||||
s->conn_err_type = STRM_ET_NONE;
|
||||
s->flags &= ~(SF_CONN_EXP | SF_ERR_MASK | SF_FINST_MASK);
|
||||
s->conn_exp = TICK_ETERNITY;
|
||||
@ -4140,7 +4140,7 @@ enum rule_result http_wait_for_msg_body(struct stream *s, struct channel *chn,
|
||||
if ((htx->flags & HTX_FL_EOM) ||
|
||||
htx_get_tail_type(htx) > HTX_BLK_DATA ||
|
||||
channel_htx_full(chn, htx, global.tune.maxrewrite) ||
|
||||
si_rx_blocked_room(chn_prod(chn)->si))
|
||||
cs_rx_blocked_room(chn_prod(chn)))
|
||||
goto end;
|
||||
|
||||
if (bytes) {
|
||||
|
@ -178,7 +178,7 @@ static int hc_cli_io_handler(struct appctx *appctx)
|
||||
chunk_appendf(trash, "%.*s %d %.*s\n", (unsigned int)istlen(hc->res.vsn), istptr(hc->res.vsn),
|
||||
hc->res.status, (unsigned int)istlen(hc->res.reason), istptr(hc->res.reason));
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1)
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
appctx->ctx.cli.i0 &= ~HC_CLI_F_RES_STLINE;
|
||||
goto out;
|
||||
}
|
||||
@ -192,7 +192,7 @@ static int hc_cli_io_handler(struct appctx *appctx)
|
||||
if (!chunk_memcat(trash, "\r\n", 2))
|
||||
goto out;
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1)
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
appctx->ctx.cli.i0 &= ~HC_CLI_F_RES_HDR;
|
||||
goto out;
|
||||
}
|
||||
@ -220,7 +220,7 @@ static int hc_cli_io_handler(struct appctx *appctx)
|
||||
out:
|
||||
/* we didn't clear every flags, we should come back to finish things */
|
||||
if (appctx->ctx.cli.i0)
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
|
||||
free_trash_chunk(trash);
|
||||
return 0;
|
||||
@ -531,7 +531,7 @@ struct appctx *httpclient_start(struct httpclient *hc)
|
||||
s->res.flags |= CF_READ_DONTWAIT;
|
||||
|
||||
/* applet is waiting for data */
|
||||
si_cant_get(cs_si(s->csf));
|
||||
cs_cant_get(s->csf);
|
||||
appctx_wakeup(appctx);
|
||||
|
||||
hc->appctx = appctx;
|
||||
@ -926,13 +926,13 @@ static void httpclient_applet_io_handler(struct appctx *appctx)
|
||||
|
||||
process_data:
|
||||
|
||||
si_rx_chan_rdy(cs->si);
|
||||
cs_rx_chan_rdy(cs);
|
||||
|
||||
return;
|
||||
more:
|
||||
/* There was not enough data in the response channel */
|
||||
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
|
||||
if (appctx->st0 == HTTPCLIENT_S_RES_END)
|
||||
goto end;
|
||||
|
10
src/map.c
10
src/map.c
@ -390,7 +390,7 @@ static int cli_io_handler_pat_list(struct appctx *appctx)
|
||||
*/
|
||||
LIST_APPEND(&elt->back_refs, &appctx->ctx.map.bref.users);
|
||||
HA_SPIN_UNLOCK(PATREF_LOCK, &appctx->ctx.map.ref->lock);
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
skip:
|
||||
@ -419,7 +419,7 @@ static int cli_io_handler_pats_list(struct appctx *appctx)
|
||||
chunk_reset(&trash);
|
||||
chunk_appendf(&trash, "# id (file) description\n");
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -450,7 +450,7 @@ static int cli_io_handler_pats_list(struct appctx *appctx)
|
||||
/* let's try again later from this stream. We add ourselves into
|
||||
* this stream's users so that it can remove us upon termination.
|
||||
*/
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -571,7 +571,7 @@ static int cli_io_handler_map_lookup(struct appctx *appctx)
|
||||
* this stream's users so that it can remove us upon termination.
|
||||
*/
|
||||
HA_SPIN_UNLOCK(PATREF_LOCK, &appctx->ctx.map.ref->lock);
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1003,7 +1003,7 @@ static int cli_io_handler_clear_map(struct appctx *appctx)
|
||||
|
||||
if (!finished) {
|
||||
/* let's come back later */
|
||||
si_rx_endp_more(cs_si(appctx->owner));
|
||||
cs_rx_endp_more(appctx->owner);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
@ -606,7 +606,7 @@ static int cli_io_handler_show_proc(struct appctx *appctx)
|
||||
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
10
src/peers.c
10
src/peers.c
@ -1186,7 +1186,7 @@ static inline int peer_send_msg(struct appctx *appctx,
|
||||
if (ret <= 0) {
|
||||
if (ret == -1) {
|
||||
/* No more write possible */
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return -1;
|
||||
}
|
||||
appctx->st0 = PEER_SESS_ST_END;
|
||||
@ -2833,7 +2833,7 @@ static void peer_io_handler(struct appctx *appctx)
|
||||
|
||||
/* Check if the input buffer is available. */
|
||||
if (cs_ib(cs)->size == 0) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -3205,7 +3205,7 @@ static struct appctx *peer_session_create(struct peers *peers, struct peer *peer
|
||||
s = DISGUISE(cs_strm(cs));
|
||||
|
||||
/* applet is waiting for data */
|
||||
si_cant_get(cs_si(s->csf));
|
||||
cs_cant_get(s->csf);
|
||||
appctx_wakeup(appctx);
|
||||
|
||||
/* initiate an outgoing connection */
|
||||
@ -3756,7 +3756,7 @@ static int peers_dump_head(struct buffer *msg, struct conn_stream *cs, struct pe
|
||||
peers->sync_task ? peers->sync_task->calls : 0);
|
||||
|
||||
if (ci_putchk(cs_ic(cs), msg) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3915,7 +3915,7 @@ static int peers_dump_peer(struct buffer *msg, struct conn_stream *cs, struct pe
|
||||
end:
|
||||
chunk_appendf(&trash, "\n");
|
||||
if (ci_putchk(cs_ic(cs), msg) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1010,7 +1010,7 @@ static int cli_io_handler_dump_pools(struct appctx *appctx)
|
||||
|
||||
dump_pools_to_trash();
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
10
src/proxy.c
10
src/proxy.c
@ -2717,7 +2717,7 @@ static int dump_servers_state(struct conn_stream *cs)
|
||||
}
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -2750,7 +2750,7 @@ static int cli_io_handler_servers_state(struct appctx *appctx)
|
||||
global.nbthread);
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
appctx->st2 = STAT_ST_INFO;
|
||||
@ -2785,7 +2785,7 @@ static int cli_io_handler_show_backend(struct appctx *appctx)
|
||||
if (!appctx->ctx.cli.p0) {
|
||||
chunk_printf(&trash, "# name\n");
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
appctx->ctx.cli.p0 = proxies_list;
|
||||
@ -2800,7 +2800,7 @@ static int cli_io_handler_show_backend(struct appctx *appctx)
|
||||
|
||||
chunk_appendf(&trash, "%s\n", curproxy->id);
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -3238,7 +3238,7 @@ static int cli_io_handler_show_errors(struct appctx *appctx)
|
||||
cant_send_unlock:
|
||||
HA_RWLOCK_RDUNLOCK(PROXY_LOCK, &appctx->ctx.errors.px->lock);
|
||||
cant_send:
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2611,7 +2611,7 @@ static int stats_dump_resolv_to_buffer(struct conn_stream *cs,
|
||||
return 1;
|
||||
|
||||
full:
|
||||
si_rx_room_rdy(cs->si);
|
||||
cs_rx_room_rdy(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2657,7 +2657,7 @@ int stats_dump_resolvers(struct conn_stream *cs,
|
||||
return 1;
|
||||
|
||||
full:
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2795,7 +2795,7 @@ static int cli_io_handler_dump_resolvers_to_buffer(struct appctx *appctx)
|
||||
/* let's try again later from this session. We add ourselves into
|
||||
* this session's users so that it can remove us upon termination.
|
||||
*/
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
/* fall through */
|
||||
|
@ -346,7 +346,7 @@ int cli_io_handler_show_ring(struct appctx *appctx)
|
||||
trash.area[trash.data++] = '\n';
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
@ -367,7 +367,7 @@ int cli_io_handler_show_ring(struct appctx *appctx)
|
||||
HA_RWLOCK_WRLOCK(LOGSRV_LOCK, &ring->lock);
|
||||
LIST_APPEND(&ring->waiters, &appctx->wait_entry);
|
||||
HA_RWLOCK_WRUNLOCK(LOGSRV_LOCK, &ring->lock);
|
||||
si_rx_endp_done(cs->si);
|
||||
cs_rx_endp_done(cs);
|
||||
ret = 0;
|
||||
}
|
||||
/* always drain all the request */
|
||||
|
@ -4339,7 +4339,7 @@ static int cli_parse_get_weight(char **args, char *payload, struct appctx *appct
|
||||
snprintf(trash.area, trash.size, "%d (initial %d)\n", sv->uweight,
|
||||
sv->iweight);
|
||||
if (ci_putstr(cs_ic(cs), trash.area) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
20
src/sink.c
20
src/sink.c
@ -330,9 +330,9 @@ static void sink_forward_io_handler(struct appctx *appctx)
|
||||
* to be notified whenever the connection completes.
|
||||
*/
|
||||
if (cs_opposite(cs)->state < CS_ST_EST) {
|
||||
si_cant_get(cs->si);
|
||||
si_rx_conn_blk(cs->si);
|
||||
si_rx_endp_more(cs->si);
|
||||
cs_cant_get(cs);
|
||||
cs_rx_conn_blk(cs);
|
||||
cs_rx_endp_more(cs);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -397,7 +397,7 @@ static void sink_forward_io_handler(struct appctx *appctx)
|
||||
trash.area[trash.data++] = '\n';
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
@ -415,7 +415,7 @@ static void sink_forward_io_handler(struct appctx *appctx)
|
||||
HA_RWLOCK_WRLOCK(LOGSRV_LOCK, &ring->lock);
|
||||
LIST_APPEND(&ring->waiters, &appctx->wait_entry);
|
||||
HA_RWLOCK_WRUNLOCK(LOGSRV_LOCK, &ring->lock);
|
||||
si_rx_endp_done(cs->si);
|
||||
cs_rx_endp_done(cs);
|
||||
}
|
||||
HA_SPIN_UNLOCK(SFT_LOCK, &sft->lock);
|
||||
|
||||
@ -470,9 +470,9 @@ static void sink_forward_oc_io_handler(struct appctx *appctx)
|
||||
* to be notified whenever the connection completes.
|
||||
*/
|
||||
if (cs_opposite(cs)->state < CS_ST_EST) {
|
||||
si_cant_get(cs->si);
|
||||
si_rx_conn_blk(cs->si);
|
||||
si_rx_endp_more(cs->si);
|
||||
cs_cant_get(cs);
|
||||
cs_rx_conn_blk(cs);
|
||||
cs_rx_endp_more(cs);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -541,7 +541,7 @@ static void sink_forward_oc_io_handler(struct appctx *appctx)
|
||||
trash.data += b_getblk(buf, p + 1, msg_len, ofs + cnt);
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
@ -559,7 +559,7 @@ static void sink_forward_oc_io_handler(struct appctx *appctx)
|
||||
HA_RWLOCK_WRLOCK(LOGSRV_LOCK, &ring->lock);
|
||||
LIST_APPEND(&ring->waiters, &appctx->wait_entry);
|
||||
HA_RWLOCK_WRUNLOCK(LOGSRV_LOCK, &ring->lock);
|
||||
si_rx_endp_done(cs->si);
|
||||
cs_rx_endp_done(cs);
|
||||
}
|
||||
HA_SPIN_UNLOCK(SFT_LOCK, &sft->lock);
|
||||
|
||||
|
@ -1261,7 +1261,7 @@ static int cli_io_handler_show_cert(struct appctx *appctx)
|
||||
|
||||
node = ebmb_next(node);
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto yield;
|
||||
}
|
||||
}
|
||||
@ -1665,7 +1665,7 @@ static int cli_io_handler_show_cert_detail(struct appctx *appctx)
|
||||
|
||||
end:
|
||||
if (ci_putchk(cs_ic(cs), out) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto yield;
|
||||
}
|
||||
|
||||
@ -1710,7 +1710,7 @@ static int cli_io_handler_show_cert_ocsp_detail(struct appctx *appctx)
|
||||
}
|
||||
|
||||
if (ci_putchk(cs_ic(cs), out) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto yield;
|
||||
}
|
||||
|
||||
@ -1979,7 +1979,7 @@ static int cli_io_handler_commit_cert(struct appctx *appctx)
|
||||
/* This state just print the update message */
|
||||
chunk_printf(trash, "Committing %s", ckchs_transaction.path);
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto yield;
|
||||
}
|
||||
appctx->st2 = SETCERT_ST_GEN;
|
||||
@ -2054,16 +2054,16 @@ static int cli_io_handler_commit_cert(struct appctx *appctx)
|
||||
chunk_appendf(trash, "\n");
|
||||
chunk_appendf(trash, "Success!\n");
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1)
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
free_trash_chunk(trash);
|
||||
/* success: call the release function and don't come back */
|
||||
return 1;
|
||||
yield:
|
||||
/* store the state */
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1)
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
free_trash_chunk(trash);
|
||||
si_rx_endp_more(cs->si); /* let's come back later */
|
||||
cs_rx_endp_more(cs); /* let's come back later */
|
||||
return 0; /* should come back */
|
||||
|
||||
error:
|
||||
@ -2071,7 +2071,7 @@ static int cli_io_handler_commit_cert(struct appctx *appctx)
|
||||
if (trash) {
|
||||
chunk_appendf(trash, "\n%sFailed!\n", err);
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1)
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
free_trash_chunk(trash);
|
||||
}
|
||||
/* error: call the release function and don't come back */
|
||||
@ -2728,7 +2728,7 @@ static int cli_io_handler_commit_cafile_crlfile(struct appctx *appctx)
|
||||
goto error;
|
||||
}
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto yield;
|
||||
}
|
||||
appctx->st2 = SETCERT_ST_GEN;
|
||||
@ -2839,16 +2839,16 @@ static int cli_io_handler_commit_cafile_crlfile(struct appctx *appctx)
|
||||
chunk_appendf(trash, "\n");
|
||||
chunk_appendf(trash, "Success!\n");
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1)
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
free_trash_chunk(trash);
|
||||
/* success: call the release function and don't come back */
|
||||
return 1;
|
||||
yield:
|
||||
/* store the state */
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1)
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
free_trash_chunk(trash);
|
||||
si_rx_endp_more(cs->si); /* let's come back later */
|
||||
cs_rx_endp_more(cs); /* let's come back later */
|
||||
return 0; /* should come back */
|
||||
|
||||
error:
|
||||
@ -2856,7 +2856,7 @@ static int cli_io_handler_commit_cafile_crlfile(struct appctx *appctx)
|
||||
if (trash) {
|
||||
chunk_appendf(trash, "\n%sFailed!\n", err);
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1)
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
free_trash_chunk(trash);
|
||||
}
|
||||
/* error: call the release function and don't come back */
|
||||
@ -2972,7 +2972,7 @@ static int cli_io_handler_show_cafile_detail(struct appctx *appctx)
|
||||
|
||||
end:
|
||||
if (ci_putchk(cs_ic(cs), out) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto yield;
|
||||
}
|
||||
|
||||
@ -3111,7 +3111,7 @@ static int cli_io_handler_show_cafile(struct appctx *appctx)
|
||||
|
||||
node = ebmb_next(node);
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto yield;
|
||||
}
|
||||
}
|
||||
@ -3631,7 +3631,7 @@ static int cli_io_handler_show_crlfile_detail(struct appctx *appctx)
|
||||
|
||||
end:
|
||||
if (ci_putchk(cs_ic(cs), out) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto yield;
|
||||
}
|
||||
|
||||
@ -3743,7 +3743,7 @@ static int cli_io_handler_show_crlfile(struct appctx *appctx)
|
||||
|
||||
node = ebmb_next(node);
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto yield;
|
||||
}
|
||||
}
|
||||
|
@ -902,7 +902,7 @@ static int cli_io_handler_dump_crtlist(struct appctx *appctx)
|
||||
while (lnode) {
|
||||
chunk_appendf(trash, "%s\n", lnode->key);
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto yield;
|
||||
}
|
||||
lnode = ebmb_next(lnode);
|
||||
@ -933,7 +933,7 @@ static int cli_io_handler_dump_crtlist_entries(struct appctx *appctx)
|
||||
entry = LIST_ELEM((crtlist->ord_entries).n, typeof(entry), by_crtlist);
|
||||
chunk_appendf(trash, "# %s\n", crtlist->node.key);
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto yield;
|
||||
}
|
||||
}
|
||||
@ -952,7 +952,7 @@ static int cli_io_handler_dump_crtlist_entries(struct appctx *appctx)
|
||||
chunk_appendf(trash, "\n");
|
||||
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto yield;
|
||||
}
|
||||
}
|
||||
@ -1068,7 +1068,7 @@ static int cli_io_handler_add_crtlist(struct appctx *appctx)
|
||||
/* This state just print the update message */
|
||||
chunk_printf(trash, "Inserting certificate '%s' in crt-list '%s'", store->path, crtlist->node.key);
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto yield;
|
||||
}
|
||||
appctx->st2 = SETCERT_ST_GEN;
|
||||
@ -1129,16 +1129,16 @@ static int cli_io_handler_add_crtlist(struct appctx *appctx)
|
||||
chunk_appendf(trash, "%s", err);
|
||||
chunk_appendf(trash, "Success!\n");
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1)
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
free_trash_chunk(trash);
|
||||
/* success: call the release function and don't come back */
|
||||
return 1;
|
||||
yield:
|
||||
/* store the state */
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1)
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
free_trash_chunk(trash);
|
||||
si_rx_endp_more(cs->si); /* let's come back later */
|
||||
cs_rx_endp_more(cs); /* let's come back later */
|
||||
return 0; /* should come back */
|
||||
|
||||
error:
|
||||
@ -1146,7 +1146,7 @@ static int cli_io_handler_add_crtlist(struct appctx *appctx)
|
||||
if (trash) {
|
||||
chunk_appendf(trash, "\n%sFailed!\n", err);
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1)
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
free_trash_chunk(trash);
|
||||
}
|
||||
/* error: call the release function and don't come back */
|
||||
|
@ -7212,7 +7212,7 @@ static int cli_io_handler_tlskeys_files(struct appctx *appctx) {
|
||||
chunk_appendf(&trash, "# id (file)\n");
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -7272,7 +7272,7 @@ static int cli_io_handler_tlskeys_files(struct appctx *appctx) {
|
||||
* this stream's users so that it can remove us upon termination.
|
||||
*/
|
||||
HA_RWLOCK_RDUNLOCK(TLSKEYS_REF_LOCK, &ref->lock);
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
appctx->ctx.cli.i1++;
|
||||
@ -7284,7 +7284,7 @@ static int cli_io_handler_tlskeys_files(struct appctx *appctx) {
|
||||
/* let's try again later from this stream. We add ourselves into
|
||||
* this stream's users so that it can remove us upon termination.
|
||||
*/
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -7528,7 +7528,7 @@ static int cli_io_handler_show_ocspresponse(struct appctx *appctx)
|
||||
|
||||
node = ebmb_next(node);
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto yield;
|
||||
}
|
||||
}
|
||||
@ -7672,7 +7672,7 @@ static int cli_io_handler_show_ocspresponse_detail(struct appctx *appctx)
|
||||
}
|
||||
|
||||
if (ci_putchk(cs_ic(cs), trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto yield;
|
||||
}
|
||||
appctx->ctx.cli.p0 = NULL;
|
||||
|
20
src/stats.c
20
src/stats.c
@ -3209,7 +3209,7 @@ int stats_dump_proxy_to_buffer(struct conn_stream *cs, struct htx *htx,
|
||||
}
|
||||
|
||||
full:
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3700,7 +3700,7 @@ static int stats_dump_proxies(struct conn_stream *cs,
|
||||
return 1;
|
||||
|
||||
full:
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3803,7 +3803,7 @@ static int stats_dump_stat_to_buffer(struct conn_stream *cs, struct htx *htx,
|
||||
}
|
||||
|
||||
full:
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
|
||||
}
|
||||
@ -4196,7 +4196,7 @@ static int stats_send_http_headers(struct conn_stream *cs, struct htx *htx)
|
||||
|
||||
full:
|
||||
htx_reset(htx);
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4255,7 +4255,7 @@ static int stats_send_http_redirect(struct conn_stream *cs, struct htx *htx)
|
||||
|
||||
full:
|
||||
htx_reset(htx);
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4283,7 +4283,7 @@ static void http_stats_io_handler(struct appctx *appctx)
|
||||
|
||||
/* Check if the input buffer is available. */
|
||||
if (!b_size(&res->buf)) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -4326,7 +4326,7 @@ static void http_stats_io_handler(struct appctx *appctx)
|
||||
*/
|
||||
if (htx_is_empty(res_htx)) {
|
||||
if (!htx_add_endof(res_htx, HTX_BLK_EOT)) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto out;
|
||||
}
|
||||
channel_add_input(res, 1);
|
||||
@ -4361,7 +4361,7 @@ static void http_stats_io_handler(struct appctx *appctx)
|
||||
*/
|
||||
htx_to_buf(res_htx, &res->buf);
|
||||
if (!channel_is_empty(res))
|
||||
si_stop_get(cs->si);
|
||||
cs_stop_get(cs);
|
||||
}
|
||||
|
||||
/* Dump all fields from <info> into <out> using the "show info" format (name: value) */
|
||||
@ -4549,7 +4549,7 @@ static int stats_dump_info_to_buffer(struct conn_stream *cs)
|
||||
stats_dump_info_fields(&trash, info, appctx->ctx.stats.flags);
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4777,7 +4777,7 @@ static int stats_dump_json_schema_to_buffer(struct conn_stream *cs)
|
||||
stats_dump_json_schema(&trash);
|
||||
|
||||
if (ci_putchk(cs_ic(cs), &trash) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -4253,7 +4253,7 @@ static int table_dump_head_to_buffer(struct buffer *msg,
|
||||
chunk_appendf(msg, "# contents not dumped due to insufficient privileges\n");
|
||||
|
||||
if (ci_putchk(cs_ic(cs), msg) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4380,7 +4380,7 @@ static int table_dump_entry_to_buffer(struct buffer *msg,
|
||||
chunk_appendf(msg, "\n");
|
||||
|
||||
if (ci_putchk(cs_ic(cs), msg) == -1) {
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
28
src/stream.c
28
src/stream.c
@ -306,7 +306,7 @@ int stream_upgrade_from_cs(struct conn_stream *cs, struct buffer *input)
|
||||
|
||||
/* Callback used to wake up a stream when an input buffer is available. The
|
||||
* stream <s>'s stream interfaces are checked for a failed buffer allocation
|
||||
* as indicated by the presence of the SI_FL_RXBLK_ROOM flag and the lack of a
|
||||
* as indicated by the presence of the CS_EP_RXBLK_ROOM flag and the lack of a
|
||||
* buffer, and and input buffer is assigned there (at most one). The function
|
||||
* returns 1 and wakes the stream up if a buffer was taken, otherwise zero.
|
||||
* It's designed to be called from __offer_buffer().
|
||||
@ -315,12 +315,12 @@ int stream_buf_available(void *arg)
|
||||
{
|
||||
struct stream *s = arg;
|
||||
|
||||
if (!s->req.buf.size && !s->req.pipe && (cs_si(s->csf)->flags & SI_FL_RXBLK_BUFF) &&
|
||||
if (!s->req.buf.size && !s->req.pipe && (s->csf->endp->flags & CS_EP_RXBLK_BUFF) &&
|
||||
b_alloc(&s->req.buf))
|
||||
si_rx_buff_rdy(cs_si(s->csf));
|
||||
else if (!s->res.buf.size && !s->res.pipe && (cs_si(s->csb)->flags & SI_FL_RXBLK_BUFF) &&
|
||||
cs_rx_buff_rdy(s->csf);
|
||||
else if (!s->res.buf.size && !s->res.pipe && (s->csb->endp->flags & CS_EP_RXBLK_BUFF) &&
|
||||
b_alloc(&s->res.buf))
|
||||
si_rx_buff_rdy(cs_si(s->csb));
|
||||
cs_rx_buff_rdy(s->csb);
|
||||
else
|
||||
return 0;
|
||||
|
||||
@ -540,7 +540,7 @@ struct stream *stream_new(struct session *sess, struct conn_stream *cs, struct b
|
||||
|
||||
/* finish initialization of the accepted file descriptor */
|
||||
if (cs_appctx(cs))
|
||||
si_want_get(cs_si(s->csf));
|
||||
cs_want_get(s->csf);
|
||||
|
||||
if (sess->fe->accept && sess->fe->accept(s) < 0)
|
||||
goto out_fail_accept;
|
||||
@ -937,7 +937,7 @@ static void back_establish(struct stream *s)
|
||||
|
||||
rep->analysers |= strm_fe(s)->fe_rsp_ana | s->be->be_rsp_ana;
|
||||
|
||||
si_rx_endp_more(si);
|
||||
cs_rx_endp_more(s->csb);
|
||||
rep->flags |= CF_READ_ATTACHED; /* producer is now attached */
|
||||
if (conn) {
|
||||
/* real connections have timeouts
|
||||
@ -1034,7 +1034,7 @@ enum act_return process_use_service(struct act_rule *rule, struct proxy *px,
|
||||
}
|
||||
|
||||
/* Now we can schedule the applet. */
|
||||
si_cant_get(cs_si(s->csb));
|
||||
cs_cant_get(s->csb);
|
||||
appctx_wakeup(appctx);
|
||||
return ACT_RET_STOP;
|
||||
}
|
||||
@ -1497,7 +1497,7 @@ int stream_set_http_mode(struct stream *s, const struct mux_proto_list *mux_prot
|
||||
|
||||
conn = cs_conn(cs);
|
||||
if (conn) {
|
||||
si_rx_endp_more(cs_si(s->csf));
|
||||
cs_rx_endp_more(s->csf);
|
||||
/* Make sure we're unsubscribed, the the new
|
||||
* mux will probably want to subscribe to
|
||||
* the underlying XPRT
|
||||
@ -1566,13 +1566,13 @@ static void stream_update_both_cs(struct stream *s)
|
||||
* handled at the latest moment.
|
||||
*/
|
||||
if (cs_appctx(csf)) {
|
||||
if ((si_rx_endp_ready(csf->si) && !si_rx_blocked(csf->si)) ||
|
||||
(si_tx_endp_ready(csf->si) && !si_tx_blocked(csf->si)))
|
||||
if ((cs_rx_endp_ready(csf) && !cs_rx_blocked(csf)) ||
|
||||
(cs_tx_endp_ready(csf) && !cs_tx_blocked(csf)))
|
||||
appctx_wakeup(__cs_appctx(csf));
|
||||
}
|
||||
if (cs_appctx(csb)) {
|
||||
if ((si_rx_endp_ready(csb->si) && !si_rx_blocked(csb->si)) ||
|
||||
(si_tx_endp_ready(csb->si) && !si_tx_blocked(csb->si)))
|
||||
if ((cs_rx_endp_ready(csb) && !cs_rx_blocked(csb)) ||
|
||||
(cs_tx_endp_ready(csb) && !cs_tx_blocked(csb)))
|
||||
appctx_wakeup(__cs_appctx(csb));
|
||||
}
|
||||
}
|
||||
@ -3768,7 +3768,7 @@ static int cli_io_handler_dump_sess(struct appctx *appctx)
|
||||
return 1;
|
||||
full:
|
||||
thread_release();
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ void si_free(struct stream_interface *si)
|
||||
* layers (applets, connections) after I/O completion. After updating the stream
|
||||
* interface and timeouts, it will try to forward what can be forwarded, then to
|
||||
* wake the associated task up if an important event requires special handling.
|
||||
* It may update SI_FL_WAIT_DATA and/or SI_FL_RXBLK_ROOM, that the callers are
|
||||
* It may update CS_EP_WAIT_DATA and/or CS_EP_RXBLK_ROOM, that the callers are
|
||||
* encouraged to watch to take appropriate action.
|
||||
* It should not be called from within the stream itself, cs_update()
|
||||
* is designed for this.
|
||||
@ -114,9 +114,9 @@ static void cs_notify(struct conn_stream *cs)
|
||||
* we're about to close and can't expect more data if SHUTW_NOW is there.
|
||||
*/
|
||||
if (!(oc->flags & (CF_SHUTW|CF_SHUTW_NOW)))
|
||||
cs->si->flags |= SI_FL_WAIT_DATA;
|
||||
cs->endp->flags |= CS_EP_WAIT_DATA;
|
||||
else if ((oc->flags & (CF_SHUTW|CF_SHUTW_NOW)) == CF_SHUTW_NOW)
|
||||
cs->si->flags &= ~SI_FL_WAIT_DATA;
|
||||
cs->endp->flags &= ~CS_EP_WAIT_DATA;
|
||||
|
||||
/* update OC timeouts and wake the other side up if it's waiting for room */
|
||||
if (oc->flags & CF_WRITE_ACTIVITY) {
|
||||
@ -131,23 +131,23 @@ static void cs_notify(struct conn_stream *cs)
|
||||
}
|
||||
|
||||
if (oc->flags & CF_DONT_READ)
|
||||
si_rx_chan_blk(cso->si);
|
||||
cs_rx_chan_blk(cso);
|
||||
else
|
||||
si_rx_chan_rdy(cso->si);
|
||||
cs_rx_chan_rdy(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
|
||||
* are output data, but we avoid doing this if some of the data are
|
||||
* not yet scheduled for being forwarded, because it is very likely
|
||||
* that it will be done again immediately afterwards once the following
|
||||
* data are parsed (eg: HTTP chunking). We only SI_FL_RXBLK_ROOM once
|
||||
* data are parsed (eg: HTTP chunking). We only CS_EP_RXBLK_ROOM once
|
||||
* we've emptied *some* of the output buffer, and not just when there
|
||||
* is available room, because applets are often forced to stop before
|
||||
* the buffer is full. We must not stop based on input data alone because
|
||||
* an HTTP parser might need more data to complete the parsing.
|
||||
*/
|
||||
if (!channel_is_empty(ic) &&
|
||||
(cso->si->flags & SI_FL_WAIT_DATA) &&
|
||||
(cso->endp->flags & CS_EP_WAIT_DATA) &&
|
||||
(!(ic->flags & CF_EXPECT_MORE) || c_full(ic) || ci_data(ic) == 0 || ic->pipe)) {
|
||||
int new_len, last_len;
|
||||
|
||||
@ -165,16 +165,16 @@ static void cs_notify(struct conn_stream *cs)
|
||||
* buffer or in the pipe.
|
||||
*/
|
||||
if (new_len < last_len)
|
||||
si_rx_room_rdy(cs->si);
|
||||
cs_rx_room_rdy(cs);
|
||||
}
|
||||
|
||||
if (!(ic->flags & CF_DONT_READ))
|
||||
si_rx_chan_rdy(cs->si);
|
||||
cs_rx_chan_rdy(cs);
|
||||
|
||||
cs_chk_rcv(cs);
|
||||
cs_chk_rcv(cso);
|
||||
|
||||
if (si_rx_blocked(cs->si)) {
|
||||
if (cs_rx_blocked(cs)) {
|
||||
ic->rex = TICK_ETERNITY;
|
||||
}
|
||||
else if ((ic->flags & (CF_SHUTR|CF_READ_PARTIAL)) == CF_READ_PARTIAL) {
|
||||
@ -439,7 +439,7 @@ int cs_conn_send(struct conn_stream *cs)
|
||||
if (cs->state == CS_ST_CON)
|
||||
cs->state = CS_ST_RDY;
|
||||
|
||||
si_rx_room_rdy(cs_opposite(cs)->si);
|
||||
cs_rx_room_rdy(cs_opposite(cs));
|
||||
}
|
||||
|
||||
if (cs->endp->flags & (CS_EP_ERROR|CS_EP_ERR_PENDING)) {
|
||||
@ -495,7 +495,7 @@ int cs_conn_sync_recv(struct conn_stream *cs)
|
||||
if (cs->wait_event.events & SUB_RETRY_RECV)
|
||||
return 0; // already subscribed
|
||||
|
||||
if (!si_rx_endp_ready(cs->si) || si_rx_blocked(cs->si))
|
||||
if (!cs_rx_endp_ready(cs) || cs_rx_blocked(cs))
|
||||
return 0; // already failed
|
||||
|
||||
return cs_conn_recv(cs);
|
||||
@ -634,7 +634,7 @@ int cs_conn_recv(struct conn_stream *cs)
|
||||
/* the pipe is full or we have read enough data that it
|
||||
* could soon be full. Let's stop before needing to poll.
|
||||
*/
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
goto done_recv;
|
||||
}
|
||||
|
||||
@ -704,7 +704,7 @@ int cs_conn_recv(struct conn_stream *cs)
|
||||
*/
|
||||
BUG_ON(c_empty(ic));
|
||||
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
/* Add READ_PARTIAL because some data are pending but
|
||||
* cannot be xferred to the channel
|
||||
*/
|
||||
@ -718,7 +718,7 @@ int cs_conn_recv(struct conn_stream *cs)
|
||||
* here to proceed.
|
||||
*/
|
||||
if (flags & CO_RFL_BUF_FLUSH)
|
||||
si_rx_room_blk(cs->si);
|
||||
cs_rx_room_blk(cs);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -748,7 +748,7 @@ int cs_conn_recv(struct conn_stream *cs)
|
||||
|
||||
if ((ic->flags & CF_READ_DONTWAIT) || --read_poll <= 0) {
|
||||
/* we're stopped by the channel's policy */
|
||||
si_rx_chan_blk(cs->si);
|
||||
cs_rx_chan_blk(cs);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -763,7 +763,7 @@ int cs_conn_recv(struct conn_stream *cs)
|
||||
*/
|
||||
if (ic->flags & CF_STREAMER) {
|
||||
/* we're stopped by the channel's policy */
|
||||
si_rx_chan_blk(cs->si);
|
||||
cs_rx_chan_blk(cs);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -772,7 +772,7 @@ int cs_conn_recv(struct conn_stream *cs)
|
||||
*/
|
||||
if (ret >= global.tune.recv_enough) {
|
||||
/* we're stopped by the channel's policy */
|
||||
si_rx_chan_blk(cs->si);
|
||||
cs_rx_chan_blk(cs);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -780,7 +780,7 @@ int cs_conn_recv(struct conn_stream *cs)
|
||||
/* if we are waiting for more space, don't try to read more data
|
||||
* right now.
|
||||
*/
|
||||
if (si_rx_blocked(cs->si))
|
||||
if (cs_rx_blocked(cs))
|
||||
break;
|
||||
} /* while !flags */
|
||||
|
||||
@ -844,12 +844,12 @@ int cs_conn_recv(struct conn_stream *cs)
|
||||
cs_conn_read0(cs);
|
||||
ret = 1;
|
||||
}
|
||||
else if (!si_rx_blocked(cs->si)) {
|
||||
else if (!cs_rx_blocked(cs)) {
|
||||
/* Subscribe to receive events if we're blocking on I/O */
|
||||
conn->mux->subscribe(cs, SUB_RETRY_RECV, &cs->wait_event);
|
||||
si_rx_endp_done(cs->si);
|
||||
cs_rx_endp_done(cs);
|
||||
} else {
|
||||
si_rx_endp_more(cs->si);
|
||||
cs_rx_endp_more(cs);
|
||||
ret = 1;
|
||||
}
|
||||
return ret;
|
||||
@ -867,7 +867,7 @@ static void cs_conn_read0(struct conn_stream *cs)
|
||||
|
||||
BUG_ON(!cs_conn(cs));
|
||||
|
||||
si_rx_shut_blk(cs->si);
|
||||
cs_rx_shut_blk(cs);
|
||||
if (ic->flags & CF_SHUTR)
|
||||
return;
|
||||
ic->flags |= CF_SHUTR;
|
||||
@ -897,7 +897,7 @@ static void cs_conn_read0(struct conn_stream *cs)
|
||||
oc->flags |= CF_SHUTW;
|
||||
oc->wex = TICK_ETERNITY;
|
||||
|
||||
si_done_get(cs->si);
|
||||
cs_done_get(cs);
|
||||
|
||||
cs->state = CS_ST_DIS;
|
||||
__cs_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
@ -918,14 +918,14 @@ int cs_applet_process(struct conn_stream *cs)
|
||||
/* If the applet wants to write and the channel is closed, it's a
|
||||
* broken pipe and it must be reported.
|
||||
*/
|
||||
if (!(cs->si->flags & SI_FL_RX_WAIT_EP) && (ic->flags & CF_SHUTR))
|
||||
if (!(cs->endp->flags & CS_EP_RX_WAIT_EP) && (ic->flags & CF_SHUTR))
|
||||
cs->endp->flags |= CS_EP_ERROR;
|
||||
|
||||
/* automatically mark the applet having data available if it reported
|
||||
* begin blocked by the channel.
|
||||
*/
|
||||
if (si_rx_blocked(cs->si))
|
||||
si_rx_endp_more(cs->si);
|
||||
if (cs_rx_blocked(cs))
|
||||
cs_rx_endp_more(cs);
|
||||
|
||||
/* update the stream-int, channels, and possibly wake the stream up */
|
||||
cs_notify(cs);
|
||||
@ -936,8 +936,8 @@ int cs_applet_process(struct conn_stream *cs)
|
||||
* appctx but in the case the task is not in runqueue we may have to
|
||||
* wakeup the appctx immediately.
|
||||
*/
|
||||
if ((si_rx_endp_ready(cs->si) && !si_rx_blocked(cs->si)) ||
|
||||
(si_tx_endp_ready(cs->si) && !si_tx_blocked(cs->si)))
|
||||
if ((cs_rx_endp_ready(cs) && !cs_rx_blocked(cs)) ||
|
||||
(cs_tx_endp_ready(cs) && !cs_tx_blocked(cs)))
|
||||
appctx_wakeup(__cs_appctx(cs));
|
||||
return 0;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit)
|
||||
*/
|
||||
|
||||
if ((req->flags & (CF_EOI|CF_SHUTR|CF_READ_ERROR)) || channel_full(req, global.tune.maxrewrite) ||
|
||||
si_rx_blocked_room(chn_prod(req)->si) ||
|
||||
cs_rx_blocked_room(chn_prod(req)) ||
|
||||
!s->be->tcp_req.inspect_delay || tick_is_expired(s->rules_exp, now_ms))
|
||||
partial = SMP_OPT_FINAL;
|
||||
else
|
||||
@ -301,7 +301,7 @@ int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit)
|
||||
* - if one rule returns KO, then return KO
|
||||
*/
|
||||
if ((rep->flags & (CF_EOI|CF_SHUTR|CF_READ_ERROR)) || channel_full(rep, global.tune.maxrewrite) ||
|
||||
si_rx_blocked_room(chn_prod(rep)->si) ||
|
||||
cs_rx_blocked_room(chn_prod(rep)) ||
|
||||
!s->be->tcp_rep.inspect_delay || tick_is_expired(s->rules_exp, now_ms))
|
||||
partial = SMP_OPT_FINAL;
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user