return 1;
full:
- si_rx_room_blk(cs->si);
+ cs_rx_room_blk(cs);
return 0;
error:
/* unrecoverable error */
return 1;
full:
htx_reset(htx);
- si_rx_room_blk(cs->si);
+ cs_rx_room_blk(cs);
return 0;
}
/* 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;
}
*/
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);
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);
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);
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 */
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
* 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)
ret = channel_alloc_buffer(cs_ic(cs), wait);
if (!ret)
- si_rx_buff_blk(cs->si);
+ cs_rx_buff_blk(cs);
return ret;
}
*/
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);
}
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 :
}
/* 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 */
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;
}
}
if (ci_putchk(cs_ic(cs), &trash) == -1) {
/* failed, try again */
- si_rx_room_blk(cs->si);
+ cs_rx_room_blk(cs);
return 0;
}
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;
}
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;
}
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;
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)
/* allocation possible now ? */
if (!b_alloc(&cs_ic(cs)->buf)) {
- si_rx_buff_blk(cs->si);
+ cs_rx_buff_blk(cs);
return 0;
}
* 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
* 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);
*/
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));
/* 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;
}
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;
}
}
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;
}
}
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;
}
}
* 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;
}
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 */
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. */
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)
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;
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
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;
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;
}
}
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;
}
{
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;
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;
/* 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;
if (ic->pipe) {
/* stop reading */
- si_rx_room_blk(cs->si);
+ cs_rx_room_blk(cs);
}
else {
/* (re)start reading */
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);
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;
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;
/* 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;
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)))
}
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);
}
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;
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;
/* 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;
/* 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))
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
* 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);
/* 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;
* 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)) {
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;
}
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;
(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;
* 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;
}
/* 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;
}
/* 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;
}
* check available_room is large
* enough here.
*/
- si_rx_room_blk(cs->si);
+ cs_rx_room_blk(cs);
ret = 0;
break;
}
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;
}
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:
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;
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;
}
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;
}
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;
* 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;
}
* 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.
/* 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++;
/* 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));
}
/* 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));
}
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 {
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));
}
* 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));
}
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));
}
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));
}
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));
}
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));
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;
}
RESET_SAFE_LJMP(hlua);
/* Wakeup the applet when data is ready for read. */
- si_cant_get(cs->si);
+ cs_cant_get(cs);
return 1;
}
/* 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 */
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;
}
}
*/
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);
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);
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;
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) {
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;
}
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;
}
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;
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;
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;
*/
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:
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;
}
/* 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;
}
* 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;
}
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;
if (ci_putchk(cs_ic(cs), &trash) == -1) {
- si_rx_room_blk(cs->si);
+ cs_rx_room_blk(cs);
return 0;
}
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;
/* 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;
}
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 */
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;
}
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;
}
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;
}
if (ci_putchk(cs_ic(cs), &trash) == -1) {
- si_rx_room_blk(cs->si);
+ cs_rx_room_blk(cs);
return 0;
}
}
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;
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;
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;
}
}
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;
}
return 1;
full:
- si_rx_room_rdy(cs->si);
+ cs_rx_room_rdy(cs);
return 0;
}
return 1;
full:
- si_rx_room_blk(cs->si);
+ cs_rx_room_blk(cs);
return 0;
}
/* 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 */
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;
}
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 */
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;
* 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;
}
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;
}
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);
* 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;
}
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;
}
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);
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;
}
}
end:
if (ci_putchk(cs_ic(cs), out) == -1) {
- si_rx_room_blk(cs->si);
+ cs_rx_room_blk(cs);
goto yield;
}
}
if (ci_putchk(cs_ic(cs), out) == -1) {
- si_rx_room_blk(cs->si);
+ cs_rx_room_blk(cs);
goto yield;
}
/* 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;
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:
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 */
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;
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:
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 */
end:
if (ci_putchk(cs_ic(cs), out) == -1) {
- si_rx_room_blk(cs->si);
+ cs_rx_room_blk(cs);
goto yield;
}
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;
}
}
end:
if (ci_putchk(cs_ic(cs), out) == -1) {
- si_rx_room_blk(cs->si);
+ cs_rx_room_blk(cs);
goto yield;
}
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;
}
}
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);
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;
}
}
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;
}
}
/* 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;
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:
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 */
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;
}
* 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++;
/* 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;
}
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;
}
}
}
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;
}
full:
- si_rx_room_blk(cs->si);
+ cs_rx_room_blk(cs);
return 0;
}
return 1;
full:
- si_rx_room_blk(cs->si);
+ cs_rx_room_blk(cs);
return 0;
}
}
full:
- si_rx_room_blk(cs->si);
+ cs_rx_room_blk(cs);
return 0;
}
full:
htx_reset(htx);
- si_rx_room_blk(cs->si);
+ cs_rx_room_blk(cs);
return 0;
}
full:
htx_reset(htx);
- si_rx_room_blk(cs->si);
+ cs_rx_room_blk(cs);
return 0;
}
/* 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;
}
*/
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);
*/
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) */
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;
}
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;
}
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;
}
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;
}
/* 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().
{
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;
/* 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;
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
}
/* 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;
}
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
* 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));
}
}
return 1;
full:
thread_release();
- si_rx_room_blk(cs->si);
+ cs_rx_room_blk(cs);
return 0;
}
* 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.
* 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) {
}
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;
* 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) {
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)) {
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);
/* 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;
}
*/
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
*/
* here to proceed.
*/
if (flags & CO_RFL_BUF_FLUSH)
- si_rx_room_blk(cs->si);
+ cs_rx_room_blk(cs);
break;
}
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;
}
*/
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;
}
*/
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;
}
}
/* 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 */
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;
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;
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;
/* 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);
* 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;
}
*/
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
* - 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