case PROMEX_ST_END:
if (!(res->flags & CF_SHUTR)) {
res->flags |= CF_READ_NULL;
- si_shutr(cs->si);
+ cs_shutr(cs);
}
}
error:
res->flags |= CF_READ_NULL;
- si_shutr(cs->si);
- si_shutw(cs->si);
+ cs_shutr(cs);
+ cs_shutw(cs);
}
struct applet promex_applet = {
return ret;
}
-/* Sends a shutr to the connection using the data layer */
-static inline void si_shutr(struct stream_interface *si)
+/* Sends a shutr to the endpoint using the data layer */
+static inline void cs_shutr(struct conn_stream *cs)
{
- si->ops->shutr(si);
+ cs->si->ops->shutr(cs->si);
}
-/* Sends a shutw to the connection using the data layer */
-static inline void si_shutw(struct stream_interface *si)
+/* Sends a shutw to the endpoint using the data layer */
+static inline void cs_shutw(struct conn_stream *cs)
{
- si->ops->shutw(si);
+ cs->si->ops->shutw(cs->si);
}
/* This is to be used after making some room available in a channel. It will
- * return without doing anything if the stream interface's RX path is blocked.
+ * return without doing anything if the conn-stream's RX path is blocked.
* It will automatically mark the stream interface as busy processing the end
* point in order to avoid useless repeated wakeups.
* It will then call ->chk_rcv() to enable receipt of new data.
*/
-static inline void si_chk_rcv(struct stream_interface *si)
+static inline void cs_chk_rcv(struct conn_stream *cs)
{
- if (si->flags & SI_FL_RXBLK_CONN && cs_state_in(si_opposite(si)->cs->state, CS_SB_RDY|CS_SB_EST|CS_SB_DIS|CS_SB_CLO))
- si_rx_conn_rdy(si);
+ if (cs->si->flags & SI_FL_RXBLK_CONN && cs_state_in(cs_opposite(cs)->state, CS_SB_RDY|CS_SB_EST|CS_SB_DIS|CS_SB_CLO))
+ si_rx_conn_rdy(cs->si);
- if (si_rx_blocked(si) || !si_rx_endp_ready(si))
+ if (si_rx_blocked(cs->si) || !si_rx_endp_ready(cs->si))
return;
- if (!cs_state_in(si->cs->state, CS_SB_RDY|CS_SB_EST))
+ if (!cs_state_in(cs->state, CS_SB_RDY|CS_SB_EST))
return;
- si->flags |= SI_FL_RX_WAIT_EP;
- si->ops->chk_rcv(si);
+ cs->si->flags |= SI_FL_RX_WAIT_EP;
+ cs->si->ops->chk_rcv(cs->si);
}
-/* Calls chk_snd on the connection using the data layer */
-static inline void si_chk_snd(struct stream_interface *si)
+/* Calls chk_snd on the endpoint using the data layer */
+static inline void cs_chk_snd(struct conn_stream *cs)
{
- si->ops->chk_snd(si);
+ cs->si->ops->chk_snd(cs->si);
}
/* Combines both si_update_rx() and si_update_tx() at once */
process_srv_queue(srv);
/* Failed and not retryable. */
- si_shutr(cs->si);
- si_shutw(cs->si);
+ cs_shutr(cs);
+ cs_shutw(cs);
req->flags |= CF_WRITE_ERROR;
s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);
if (srv)
_HA_ATOMIC_INC(&srv->counters.failed_conns);
_HA_ATOMIC_INC(&s->be->be_counters.failed_conns);
- si_shutr(cs->si);
- si_shutw(cs->si);
+ cs_shutr(cs);
+ cs_shutw(cs);
req->flags |= CF_WRITE_TIMEOUT;
if (!s->conn_err_type)
s->conn_err_type = STRM_ET_QUEUE_TO;
/* give up */
s->conn_exp = TICK_ETERNITY;
s->flags &= ~SF_CONN_EXP;
- si_shutr(cs->si);
- si_shutw(cs->si);
+ cs_shutr(cs);
+ cs_shutw(cs);
cs->state = CS_ST_CLO;
if (s->srv_error)
s->srv_error(s, cs->si);
*/
s->flags &= ~(SF_ERR_MASK | SF_FINST_MASK);
- si_shutr(cs->si);
- si_shutw(cs->si);
+ cs_shutr(cs);
+ cs_shutw(cs);
s->req.flags |= CF_WRITE_ERROR;
s->conn_err_type = STRM_ET_CONN_RES;
cs->state = CS_ST_CLO;
}
/* we did not get any server, let's check the cause */
- si_shutr(cs->si);
- si_shutw(cs->si);
+ cs_shutr(cs);
+ cs_shutw(cs);
s->req.flags |= CF_WRITE_ERROR;
if (!s->conn_err_type)
s->conn_err_type = STRM_ET_CONN_OTHER;
((req->flags & CF_SHUTW_NOW) &&
(channel_is_empty(req) || (s->be->options & PR_O_ABRT_CLOSE)))) {
cs->flags |= CS_FL_NOLINGER;
- si_shutw(cs->si);
+ cs_shutw(cs);
s->conn_err_type |= STRM_ET_CONN_ABRT;
if (s->srv_error)
s->srv_error(s, cs->si);
if (may_dequeue_tasks(objt_server(s->target), s->be))
process_srv_queue(objt_server(s->target));
- /* shutw is enough so stop a connecting socket */
- si_shutw(cs->si);
+ /* shutw is enough to stop a connecting socket */
+ cs_shutw(cs);
s->req.flags |= CF_WRITE_ERROR;
s->res.flags |= CF_READ_ERROR;
if (may_dequeue_tasks(objt_server(s->target), s->be))
process_srv_queue(objt_server(s->target));
- /* shutw is enough so stop a connecting socket */
- si_shutw(cs->si);
+ /* shutw is enough to stop a connecting socket */
+ cs_shutw(cs);
s->req.flags |= CF_WRITE_ERROR;
s->res.flags |= CF_READ_ERROR;
(channel_is_empty(req) || (s->be->options & PR_O_ABRT_CLOSE)))) {
/* give up */
cs->flags |= CS_FL_NOLINGER;
- si_shutw(cs->si);
+ cs_shutw(cs);
s->conn_err_type |= STRM_ET_CONN_ABRT;
if (s->srv_error)
s->srv_error(s, cs->si);
end:
if (!(res->flags & CF_SHUTR) && appctx->st0 == HTX_CACHE_END) {
res->flags |= CF_READ_NULL;
- si_shutr(cs->si);
+ cs_shutr(cs);
}
out:
/* Let's close for real now. We just close the request
* side, the conditions below will complete if needed.
*/
- si_shutw(cs->si);
+ cs_shutw(cs);
free_trash_chunk(appctx->chunk);
appctx->chunk = NULL;
break;
* we forward the close to the request side so that it flows upstream to
* the client.
*/
- si_shutw(cs->si);
+ cs_shutw(cs);
}
if ((req->flags & CF_SHUTW) && (cs->state == CS_ST_EST) && (appctx->st0 < CLI_ST_OUTPUT)) {
* the client side has closed. So we'll forward this state downstream
* on the response buffer.
*/
- si_shutr(cs->si);
+ cs_shutr(cs);
res->flags |= CF_READ_NULL;
}
pcli_write_prompt(s);
s->csb->flags |= CS_FL_NOLINGER | CS_FL_NOHALF;
- si_shutr(cs_si(s->csb));
- si_shutw(cs_si(s->csb));
+ cs_shutr(s->csb);
+ cs_shutw(s->csb);
/*
* starting from there this the same code as
return;
close:
- si_shutw(cs->si);
- si_shutr(cs->si);
+ cs_shutw(cs);
+ cs_shutr(cs);
cs_ic(cs)->flags |= CF_READ_NULL;
}
if (spoe_appctx->status_code == SPOE_FRM_ERR_NONE)
spoe_appctx->status_code = SPOE_FRM_ERR_IO;
- si_shutw(cs->si);
- si_shutr(cs->si);
+ cs_shutw(cs);
+ cs_shutr(cs);
cs_ic(cs)->flags |= CF_READ_NULL;
}
appctx->st0 = SPOE_APPCTX_ST_END;
SPOE_APPCTX(appctx)->task->expire = TICK_ETERNITY;
- si_shutw(cs->si);
- si_shutr(cs->si);
+ cs_shutw(cs);
+ cs_shutr(cs);
cs_ic(cs)->flags |= CF_READ_NULL;
/* fall through */
struct conn_stream *cs = appctx->owner;
if (appctx->ctx.hlua_cosocket.die) {
- si_shutw(cs->si);
- si_shutr(cs->si);
+ cs_shutw(cs);
+ cs_shutr(cs);
cs_ic(cs)->flags |= CF_READ_NULL;
notification_wake(&appctx->ctx.hlua_cosocket.wake_on_read);
notification_wake(&appctx->ctx.hlua_cosocket.wake_on_write);
/* eat the whole request */
co_skip(cs_oc(cs), co_data(cs_oc(cs)));
res->flags |= CF_READ_NULL;
- si_shutr(cs->si);
+ cs_shutr(cs);
return;
/* yield. */
error:
/* For all other cases, just close the stream. */
- si_shutw(cs->si);
- si_shutr(cs->si);
+ cs_shutw(cs);
+ cs_shutr(cs);
ctx->ctx.hlua_apptcp.flags |= APPLET_DONE;
}
if (ctx->ctx.hlua_apphttp.flags & APPLET_DONE) {
if (!(res->flags & CF_SHUTR)) {
res->flags |= CF_READ_NULL;
- si_shutr(cs->si);
+ cs_shutr(cs);
}
/* eat the whole request */
goto fail;
/* return without error. */
- si_shutr(si);
- si_shutw(si);
+ cs_shutr(si->cs);
+ cs_shutw(si->cs);
s->conn_err_type = STRM_ET_NONE;
si->cs->state = CS_ST_CLO;
/* we must close only if F_END is the last flag */
if (appctx->ctx.cli.i0 == HC_CLI_F_RES_END) {
- si_shutw(cs->si);
- si_shutr(cs->si);
+ cs_shutw(cs);
+ cs_shutr(cs);
appctx->ctx.cli.i0 &= ~HC_CLI_F_RES_END;
goto out;
}
return;
end:
- si_shutw(cs->si);
- si_shutr(cs->si);
+ cs_shutw(cs);
+ cs_shutr(cs);
return;
}
_HA_ATOMIC_INC(&frontend->fe_counters.cli_aborts);
close:
- si_shutw(cs->si);
- si_shutr(cs->si);
+ cs_shutw(cs);
+ cs_shutr(cs);
cs_ic(cs)->flags |= CF_READ_NULL;
HA_SPIN_UNLOCK(PEER_LOCK, &curpeer->lock);
curpeer = NULL;
}
- si_shutw(cs->si);
- si_shutr(cs->si);
+ cs_shutw(cs);
+ cs_shutr(cs);
cs_ic(cs)->flags |= CF_READ_NULL;
goto out;
}
return;
close:
- si_shutw(cs->si);
- si_shutr(cs->si);
+ cs_shutw(cs);
+ cs_shutr(cs);
cs_ic(cs)->flags |= CF_READ_NULL;
}
return;
close:
- si_shutw(cs->si);
- si_shutr(cs->si);
+ cs_shutw(cs);
+ cs_shutr(cs);
cs_ic(cs)->flags |= CF_READ_NULL;
}
if (appctx->st0 == STAT_HTTP_END) {
if (!(res->flags & CF_SHUTR)) {
res->flags |= CF_READ_NULL;
- si_shutr(cs->si);
+ cs_shutr(cs);
}
/* eat the whole request */
* delayed recv here to give a chance to the data to flow back
* by the time we process other tasks.
*/
- si_chk_rcv(si);
+ cs_chk_rcv(si->cs);
}
req->wex = TICK_ETERNITY;
/* If we managed to get the whole response, and we don't have anything
if (unlikely((req->flags & (CF_SHUTW|CF_WRITE_TIMEOUT)) == CF_WRITE_TIMEOUT)) {
s->csb->flags |= CS_FL_NOLINGER;
- si_shutw(si_b);
+ cs_shutw(s->csb);
}
if (unlikely((req->flags & (CF_SHUTR|CF_READ_TIMEOUT)) == CF_READ_TIMEOUT)) {
if (s->csf->flags & CS_FL_NOHALF)
s->csf->flags |= CS_FL_NOLINGER;
- si_shutr(si_f);
+ cs_shutr(s->csf);
}
channel_check_timeouts(res);
if (unlikely((res->flags & (CF_SHUTW|CF_WRITE_TIMEOUT)) == CF_WRITE_TIMEOUT)) {
s->csf->flags |= CS_FL_NOLINGER;
- si_shutw(si_f);
+ cs_shutw(s->csf);
}
if (unlikely((res->flags & (CF_SHUTR|CF_READ_TIMEOUT)) == CF_READ_TIMEOUT)) {
if (s->csb->flags & CS_FL_NOHALF)
s->csb->flags |= CS_FL_NOLINGER;
- si_shutr(si_b);
+ cs_shutr(s->csb);
}
if (HAS_FILTERS(s))
srv = objt_server(s->target);
if (unlikely(s->csf->endp->flags & CS_EP_ERROR)) {
if (cs_state_in(s->csf->state, CS_SB_EST|CS_SB_DIS)) {
- si_shutr(si_f);
- si_shutw(si_f);
+ cs_shutr(s->csf);
+ cs_shutw(s->csf);
cs_report_error(si_f->cs);
if (!(req->analysers) && !(res->analysers)) {
_HA_ATOMIC_INC(&s->be->be_counters.cli_aborts);
if (unlikely(s->csb->endp->flags & CS_EP_ERROR)) {
if (cs_state_in(s->csb->state, CS_SB_EST|CS_SB_DIS)) {
- si_shutr(si_b);
- si_shutw(si_b);
+ cs_shutr(s->csb);
+ cs_shutw(s->csb);
cs_report_error(si_b->cs);
_HA_ATOMIC_INC(&s->be->be_counters.failed_resp);
if (srv)
channel_is_empty(req))) {
if (req->flags & CF_READ_ERROR)
s->csb->flags |= CS_FL_NOLINGER;
- si_shutw(si_b);
+ cs_shutw(s->csb);
}
/* shutdown(write) done on server side, we must stop the client too */
if (unlikely((req->flags & (CF_SHUTR|CF_SHUTR_NOW)) == CF_SHUTR_NOW)) {
if (s->csf->flags & CS_FL_NOHALF)
s->csf->flags |= CS_FL_NOLINGER;
- si_shutr(si_f);
+ cs_shutr(s->csf);
}
/* Benchmarks have shown that it's optimal to do a full resync now */
/* shutdown(write) pending */
if (unlikely((res->flags & (CF_SHUTW|CF_SHUTW_NOW)) == CF_SHUTW_NOW &&
channel_is_empty(res))) {
- si_shutw(si_f);
+ cs_shutw(s->csf);
}
/* shutdown(write) done on the client side, we must stop the server too */
if (unlikely((res->flags & (CF_SHUTR|CF_SHUTR_NOW)) == CF_SHUTR_NOW)) {
if (s->csb->flags & CS_FL_NOHALF)
s->csb->flags |= CS_FL_NOLINGER;
- si_shutr(si_b);
+ cs_shutr(s->csb);
}
if (s->csf->state == CS_ST_DIS ||
if (((oc->flags & (CF_SHUTW|CF_SHUTW_NOW)) == CF_SHUTW_NOW) &&
(si->cs->state == CS_ST_EST) && (!conn || !(conn->flags & (CO_FL_WAIT_XPRT | CO_FL_EARLY_SSL_HS))))
- si_shutw(si);
+ cs_shutw(si->cs);
oc->wex = TICK_ETERNITY;
}
if (ic->pipe)
last_len += ic->pipe->data;
- si_chk_snd(sio);
+ cs_chk_snd(sio->cs);
new_len = co_data(ic);
if (ic->pipe)
if (!(ic->flags & CF_DONT_READ))
si_rx_chan_rdy(si);
- si_chk_rcv(si);
- si_chk_rcv(sio);
+ cs_chk_rcv(si->cs);
+ cs_chk_rcv(sio->cs);
if (si_rx_blocked(si)) {
ic->rex = TICK_ETERNITY;
}
else if ((ic->flags & (CF_SHUTR|CF_READ_PARTIAL)) == CF_READ_PARTIAL) {
- /* we must re-enable reading if si_chk_snd() has freed some space */
+ /* we must re-enable reading if cs_chk_snd() has freed some space */
if (!(ic->flags & CF_READ_NOEXP) && tick_isset(ic->rex))
ic->rex = tick_add_ifset(now_ms, ic->rto);
}
else if (!(ic->flags & CF_READ_NOEXP) && !tick_isset(ic->rex))
ic->rex = tick_add_ifset(now_ms, ic->rto);
- si_chk_rcv(si);
+ cs_chk_rcv(si->cs);
}
/* This function is designed to be called from within the stream handler to
if (((oc->flags & (CF_SHUTW|CF_AUTO_CLOSE|CF_SHUTW_NOW)) ==
(CF_AUTO_CLOSE|CF_SHUTW_NOW)) &&
cs_state_in(cs->state, CS_SB_RDY|CS_SB_EST)) {
- si_shutw(si);
+ cs_shutw(cs);
goto out_wakeup;
}
if ((oc->flags & (CF_SHUTW|CF_SHUTW_NOW)) == 0)
- si->flags |= SI_FL_WAIT_DATA;
+ cs->si->flags |= SI_FL_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.
*/
- si->flags &= ~SI_FL_WAIT_DATA;
+ cs->si->flags &= ~SI_FL_WAIT_DATA;
if (!tick_isset(oc->wex))
oc->wex = tick_add_ifset(now_ms, oc->wto);
}
if (likely(oc->flags & CF_WRITE_ACTIVITY)) {
- struct channel *ic = si_ic(si);
+ struct channel *ic = cs_ic(cs);
/* update timeout if we have written something */
if ((oc->flags & (CF_SHUTW|CF_WRITE_PARTIAL)) == CF_WRITE_PARTIAL &&
((channel_is_empty(oc) && !oc->to_forward) ||
!cs_state_in(cs->state, CS_SB_EST))))) {
out_wakeup:
- if (!(si->cs->flags & CS_FL_DONT_WAKE))
- task_wakeup(si_task(si), TASK_WOKEN_IO);
+ if (!(cs->flags & CS_FL_DONT_WAKE))
+ task_wakeup(cs_strm_task(cs), TASK_WOKEN_IO);
}
}
return;
do_close:
- /* OK we completely close the socket here just as if we went through si_shut[rw]() */
+ /* OK we completely close the socket here just as if we went through cs_shut[rw]() */
cs_conn_close(cs);
oc->flags &= ~CF_SHUTW_NOW;
else if (rule->action == ACT_TCP_CLOSE) {
chn_prod(rep)->flags |= CS_FL_NOLINGER | CS_FL_NOHALF;
cs_must_kill_conn(chn_prod(rep));
- si_shutr(chn_prod(rep)->si);
- si_shutw(chn_prod(rep)->si);
+ cs_shutr(chn_prod(rep));
+ cs_shutw(chn_prod(rep));
s->last_rule_file = rule->conf.file;
s->last_rule_line = rule->conf.line;
goto end;