printf("0\n");
return;
}
+ SHOW_FLAG(f, CS_FL_NOLINGER);
+ SHOW_FLAG(f, CS_FL_NOHALF);
SHOW_FLAG(f, CS_FL_ADDR_FROM_SET);
SHOW_FLAG(f, CS_FL_ADDR_TO_SET);
SHOW_FLAG(f, CS_FL_ISBACK);
SHOW_FLAG(f, SI_FL_ISBACK);
SHOW_FLAG(f, SI_FL_DONT_WAKE);
SHOW_FLAG(f, SI_FL_INDEP_STR);
- SHOW_FLAG(f, SI_FL_NOLINGER);
- SHOW_FLAG(f, SI_FL_NOHALF);
SHOW_FLAG(f, SI_FL_SRC_ADDR);
SHOW_FLAG(f, SI_FL_WANT_GET);
SHOW_FLAG(f, SI_FL_CLEAN_ABRT);
CS_FL_ADDR_FROM_SET = 0x00000002, /* source address is set */
CS_FL_ADDR_TO_SET = 0x00000004, /* destination address is set */
+
+ CS_FL_NOLINGER = 0x00000008, /* may close without lingering. One-shot. */
+ CS_FL_NOHALF = 0x00000010, /* no half close, close both sides at once */
};
/* cs_shutr() modes */
SI_FL_ISBACK = 0x00000010, /* 0 for front-side SI, 1 for back-side */
SI_FL_DONT_WAKE = 0x00000020, /* resync in progress, don't wake up */
SI_FL_INDEP_STR = 0x00000040, /* independent streams = don't update rex on write */
- SI_FL_NOLINGER = 0x00000080, /* may close without lingering. One-shot. */
- SI_FL_NOHALF = 0x00000100, /* no half close, close both sides at once */
SI_FL_SRC_ADDR = 0x00001000, /* get the source ip/port with getsockname */
/* unused: 0x00000200 */
SI_FL_WANT_GET = 0x00004000, /* a stream-int would like to get some data from the buffer */
/* disable lingering */
if (s->be->options & PR_O_TCP_NOLING)
- cs_si(s->csb)->flags |= SI_FL_NOLINGER;
+ s->csb->flags |= CS_FL_NOLINGER;
if (s->flags & SF_SRV_REUSED) {
_HA_ATOMIC_INC(&s->be->be_counters.reuse);
if ((rep->flags & CF_SHUTW) ||
((req->flags & CF_SHUTW_NOW) &&
(channel_is_empty(req) || (s->be->options & PR_O_ABRT_CLOSE)))) {
- cs->si->flags |= SI_FL_NOLINGER;
+ cs->flags |= CS_FL_NOLINGER;
si_shutw(cs->si);
cs->si->err_type |= SI_ET_CONN_ABRT;
if (s->srv_error)
((req->flags & CF_SHUTW_NOW) &&
(channel_is_empty(req) || (s->be->options & PR_O_ABRT_CLOSE)))) {
/* give up */
- cs->si->flags |= SI_FL_NOLINGER;
+ cs->flags |= CS_FL_NOLINGER;
si_shutw(cs->si);
cs->si->err_type |= SI_ET_CONN_ABRT;
if (s->srv_error)
pcli_write_prompt(s);
- cs_si(s->csb)->flags |= SI_FL_NOLINGER | SI_FL_NOHALF;
+ s->csb->flags |= CS_FL_NOLINGER | CS_FL_NOHALF;
si_shutr(cs_si(s->csb));
si_shutw(cs_si(s->csb));
s = DISGUISE(cs_strm(cs));
s->csb->dst = addr;
- cs_si(s->csb)->flags |= SI_FL_NOLINGER;
+ s->csb->flags |= CS_FL_NOLINGER;
s->target = &ds->dss->srv->obj_type;
s->flags = SF_ASSIGNED|SF_ADDR_SET;
if (s->be->options & PR_O_ABRT_CLOSE) {
channel_auto_read(req);
if ((req->flags & (CF_SHUTR|CF_READ_NULL)) && !(txn->flags & TX_CON_WANT_TUN))
- cs_si(s->csb)->flags |= SI_FL_NOLINGER;
+ s->csb->flags |= CS_FL_NOLINGER;
channel_auto_close(req);
}
else if (s->txn->meth == HTTP_METH_POST) {
stream_inc_http_fail_ctr(s);
}
- si_b->flags |= SI_FL_NOLINGER;
+ s->csb->flags |= CS_FL_NOLINGER;
http_reply_and_close(s, txn->status, http_error_message(s));
if (!(s->flags & SF_ERR_MASK))
txn->status = 504;
stream_inc_http_fail_ctr(s);
- si_b->flags |= SI_FL_NOLINGER;
+ s->csb->flags |= CS_FL_NOLINGER;
http_reply_and_close(s, txn->status, http_error_message(s));
if (!(s->flags & SF_ERR_MASK))
txn->status = 502;
stream_inc_http_fail_ctr(s);
- si_b->flags |= SI_FL_NOLINGER;
+ s->csb->flags |= CS_FL_NOLINGER;
http_reply_and_close(s, txn->status, http_error_message(s));
if (!(s->flags & SF_ERR_MASK))
if (!(s->flags & SF_FINST_MASK))
s->flags |= SF_FINST_H;
- si_b->flags |= SI_FL_NOLINGER;
+ s->csb->flags |= CS_FL_NOLINGER;
DBG_TRACE_DEVEL("leaving on error",
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);
return 0;
return_prx_cond:
s->logs.t_data = -1; /* was not a valid response */
- cs_si(s->csb)->flags |= SI_FL_NOLINGER;
+ s->csb->flags |= CS_FL_NOLINGER;
if (!(s->flags & SF_ERR_MASK))
s->flags |= SF_ERR_PRXCOND;
/* if the server closes the connection, we want to immediately react
* and close the socket to save packets and syscalls.
*/
- cs_si(s->csb)->flags |= SI_FL_NOHALF;
+ s->csb->flags |= CS_FL_NOHALF;
/* In any case we've finished parsing the request so we must
* disable Nagle when sending data because 1) we're not going
http_msg_closed:
/* if we don't know whether the server will close, we need to hard close */
if (txn->rsp.flags & HTTP_MSGF_XFER_LEN)
- cs_si(s->csb)->flags |= SI_FL_NOLINGER; /* we want to close ASAP */
+ s->csb->flags |= CS_FL_NOLINGER; /* we want to close ASAP */
/* see above in MSG_DONE why we only do this in these states */
if (!(s->be->options & PR_O_ABRT_CLOSE))
channel_dont_read(chn);
}
s->csb->dst = addr;
- cs_si(s->csb)->flags |= SI_FL_NOLINGER;
+ s->csb->flags |= CS_FL_NOLINGER;
s->flags |= SF_ASSIGNED|SF_ADDR_SET;
s->res.flags |= CF_READ_DONTWAIT;
/* initiate an outgoing connection */
s->csb->dst = addr;
- cs_si(s->csb)->flags |= SI_FL_NOLINGER;
+ s->csb->flags |= CS_FL_NOLINGER;
s->flags = SF_ASSIGNED|SF_ADDR_SET;
s->target = peer_session_target(peer, s);
s = DISGUISE(cs_strm(cs));
s->csb->dst = addr;
- cs_si(s->csb)->flags |= SI_FL_NOLINGER;
+ s->csb->flags |= CS_FL_NOLINGER;
s->target = &sft->srv->obj_type;
s->flags = SF_ASSIGNED|SF_ADDR_SET;
channel_check_timeouts(req);
if (unlikely((req->flags & (CF_SHUTW|CF_WRITE_TIMEOUT)) == CF_WRITE_TIMEOUT)) {
- si_b->flags |= SI_FL_NOLINGER;
+ s->csb->flags |= CS_FL_NOLINGER;
si_shutw(si_b);
}
if (unlikely((req->flags & (CF_SHUTR|CF_READ_TIMEOUT)) == CF_READ_TIMEOUT)) {
- if (si_f->flags & SI_FL_NOHALF)
- si_f->flags |= SI_FL_NOLINGER;
+ if (s->csf->flags & CS_FL_NOHALF)
+ s->csf->flags |= CS_FL_NOLINGER;
si_shutr(si_f);
}
channel_check_timeouts(res);
if (unlikely((res->flags & (CF_SHUTW|CF_WRITE_TIMEOUT)) == CF_WRITE_TIMEOUT)) {
- si_f->flags |= SI_FL_NOLINGER;
+ s->csf->flags |= CS_FL_NOLINGER;
si_shutw(si_f);
}
if (unlikely((res->flags & (CF_SHUTR|CF_READ_TIMEOUT)) == CF_READ_TIMEOUT)) {
- if (si_b->flags & SI_FL_NOHALF)
- si_b->flags |= SI_FL_NOLINGER;
+ if (s->csb->flags & CS_FL_NOHALF)
+ s->csb->flags |= CS_FL_NOLINGER;
si_shutr(si_b);
}
if (unlikely((req->flags & (CF_SHUTW|CF_SHUTW_NOW)) == CF_SHUTW_NOW &&
channel_is_empty(req))) {
if (req->flags & CF_READ_ERROR)
- si_b->flags |= SI_FL_NOLINGER;
+ s->csb->flags |= CS_FL_NOLINGER;
si_shutw(si_b);
}
/* shutdown(read) pending */
if (unlikely((req->flags & (CF_SHUTR|CF_SHUTR_NOW)) == CF_SHUTR_NOW)) {
- if (si_f->flags & SI_FL_NOHALF)
- si_f->flags |= SI_FL_NOLINGER;
+ if (s->csf->flags & CS_FL_NOHALF)
+ s->csf->flags |= CS_FL_NOLINGER;
si_shutr(si_f);
}
/* shutdown(read) pending */
if (unlikely((res->flags & (CF_SHUTR|CF_SHUTR_NOW)) == CF_SHUTR_NOW)) {
- if (si_b->flags & SI_FL_NOHALF)
- si_b->flags |= SI_FL_NOLINGER;
+ if (s->csb->flags & CS_FL_NOHALF)
+ s->csb->flags |= CS_FL_NOLINGER;
si_shutr(si_b);
}
* This function performs a shutdown-read on a detached stream interface in a
* connected or init state (it does nothing for other states). It either shuts
* the read side or marks itself as closed. The buffer flags are updated to
- * reflect the new state. If the stream interface has SI_FL_NOHALF, we also
+ * reflect the new state. If the stream interface has CS_FL_NOHALF, we also
* forward the close to the write side. The owner task is woken up if it exists.
*/
static void stream_int_shutr(struct stream_interface *si)
si->state = SI_ST_DIS;
__cs_strm(si->cs)->conn_exp = TICK_ETERNITY;
}
- else if (si->flags & SI_FL_NOHALF) {
+ else if (si->cs->flags & CS_FL_NOHALF) {
/* we want to immediately forward this close to the write side */
return stream_int_shutw(si);
}
/* we have to shut before closing, otherwise some short messages
* may never leave the system, especially when there are remaining
* unread data in the socket input buffer, or when nolinger is set.
- * However, if SI_FL_NOLINGER is explicitly set, we know there is
+ * However, if CS_FL_NOLINGER is explicitly set, we know there is
* no risk so we close both sides immediately.
*/
- if (!(si->cs->endp->flags & CS_EP_ERROR) && !(si->flags & SI_FL_NOLINGER) &&
+ if (!(si->cs->endp->flags & CS_EP_ERROR) && !(si->cs->flags & CS_FL_NOLINGER) &&
!(ic->flags & (CF_SHUTR|CF_DONT_READ)))
return;
si->state = SI_ST_DIS;
/* fall through */
default:
- si->flags &= ~SI_FL_NOLINGER;
+ si->cs->flags &= ~CS_FL_NOLINGER;
si_rx_shut_blk(si);
ic->flags |= CF_SHUTR;
ic->rex = TICK_ETERNITY;
* a connection in a connected or init state (it does nothing for other
* states). It either shuts the read side or marks itself as closed. The buffer
* flags are updated to reflect the new state. If the stream interface has
- * SI_FL_NOHALF, we also forward the close to the write side. If a control
+ * CS_FL_NOHALF, we also forward the close to the write side. If a control
* layer is defined, then it is supposed to be a socket layer and file
* descriptors are then shutdown or closed accordingly. The function
* automatically disables polling if needed.
si->state = SI_ST_DIS;
__cs_strm(cs)->conn_exp = TICK_ETERNITY;
}
- else if (si->flags & SI_FL_NOHALF) {
+ else if (si->cs->flags & CS_FL_NOHALF) {
/* we want to immediately forward this close to the write side */
return stream_int_shutw_conn(si);
}
/* we have to shut before closing, otherwise some short messages
* may never leave the system, especially when there are remaining
* unread data in the socket input buffer, or when nolinger is set.
- * However, if SI_FL_NOLINGER is explicitly set, we know there is
+ * However, if CS_FL_NOLINGER is explicitly set, we know there is
* no risk so we close both sides immediately.
*/
if (cs->endp->flags & CS_EP_ERROR) {
/* quick close, the socket is already shut anyway */
}
- else if (si->flags & SI_FL_NOLINGER) {
+ else if (cs->flags & CS_FL_NOLINGER) {
/* unclean data-layer shutdown, typically an aborted request
* or a forwarded shutdown from a client to a server due to
* option abortonclose. No need for the TLS layer to try to
si->state = SI_ST_DIS;
/* fall through */
default:
- si->flags &= ~SI_FL_NOLINGER;
+ cs->flags &= ~CS_FL_NOLINGER;
si_rx_shut_blk(si);
ic->flags |= CF_SHUTR;
ic->rex = TICK_ETERNITY;
/*
* This function propagates a null read received on a socket-based connection.
- * It updates the stream interface. If the stream interface has SI_FL_NOHALF,
+ * It updates the stream interface. If the stream interface has CS_FL_NOHALF,
* the close is also forwarded to the write side as an abort.
*/
static void stream_int_read0(struct stream_interface *si)
if (oc->flags & CF_SHUTW)
goto do_close;
- if (si->flags & SI_FL_NOHALF) {
+ if (cs->flags & CS_FL_NOHALF) {
/* we want to immediately forward this close to the write side */
/* force flag on ssl to keep stream in cache */
cs_shutw(cs, CS_SHW_SILENT);
* This function performs a shutdown-read on a stream interface attached to an
* applet in a connected or init state (it does nothing for other states). It
* either shuts the read side or marks itself as closed. The buffer flags are
- * updated to reflect the new state. If the stream interface has SI_FL_NOHALF,
+ * updated to reflect the new state. If the stream interface has CS_FL_NOHALF,
* we also forward the close to the write side. The owner task is woken up if
* it exists.
*/
si->state = SI_ST_DIS;
__cs_strm(si->cs)->conn_exp = TICK_ETERNITY;
}
- else if (si->flags & SI_FL_NOHALF) {
+ else if (si->cs->flags & CS_FL_NOHALF) {
/* we want to immediately forward this close to the write side */
return stream_int_shutw_applet(si);
}
/* we have to shut before closing, otherwise some short messages
* may never leave the system, especially when there are remaining
* unread data in the socket input buffer, or when nolinger is set.
- * However, if SI_FL_NOLINGER is explicitly set, we know there is
+ * However, if CS_FL_NOLINGER is explicitly set, we know there is
* no risk so we close both sides immediately.
*/
- if (!(si->cs->endp->flags & CS_EP_ERROR) && !(si->flags & SI_FL_NOLINGER) &&
+ if (!(si->cs->endp->flags & CS_EP_ERROR) && !(si->cs->flags & CS_FL_NOLINGER) &&
!(ic->flags & (CF_SHUTR|CF_DONT_READ)))
return;
si->state = SI_ST_DIS;
/* fall through */
default:
- si->flags &= ~SI_FL_NOLINGER;
+ si->cs->flags &= ~CS_FL_NOLINGER;
si_rx_shut_blk(si);
ic->flags |= CF_SHUTR;
ic->rex = TICK_ETERNITY;
* is present, returning with ERR will cause lingering to be disabled.
*/
if (strm)
- strm->csf->si->flags |= SI_FL_NOLINGER;
+ strm->csf->flags |= CS_FL_NOLINGER;
if (conn->flags & CO_FL_FDLESS)
goto out;
goto deny;
}
else if (rule->action == ACT_TCP_CLOSE) {
- chn_prod(rep)->si->flags |= SI_FL_NOLINGER | SI_FL_NOHALF;
+ 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);