/* Returns true if the channel's output is already closed */
static inline int channel_output_closed(struct channel *chn)
{
- return ((chn_cons(chn)->flags & SC_FL_SHUTW) != 0);
+ return ((chn_cons(chn)->flags & SC_FL_SHUT_DONE) != 0);
}
/* Check channel timeouts, and set the corresponding flags. */
static inline int co_getchr(struct channel *chn)
{
/* closed or empty + imminent close = -2; empty = -1 */
- if (unlikely((chn_cons(chn)->flags & SC_FL_SHUTW) || channel_is_empty(chn))) {
- if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))
+ if (unlikely((chn_cons(chn)->flags & SC_FL_SHUT_DONE) || channel_is_empty(chn))) {
+ if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))
return -2;
return -1;
}
__attribute__((warn_unused_result))
static inline int sc_is_send_allowed(const struct stconn *sc)
{
- if (sc->flags & SC_FL_SHUTW)
+ if (sc->flags & SC_FL_SHUT_DONE)
return 0;
return !sc_ep_test(sc, SE_FL_WAIT_DATA | SE_FL_WONT_CONSUME);
static inline int sc_snd_may_expire(const struct stconn *sc)
{
- if ((sc->flags & SC_FL_SHUTW) ||
+ if ((sc->flags & SC_FL_SHUT_DONE) ||
(sc_oc(sc)->flags & (CF_WRITE_TIMEOUT|CF_WRITE_EVENT)))
return 0;
if (sc_ep_test(sc, SE_FL_WONT_CONSUME))
SC_FL_ABRT_WANTED = 0x00002000, /* An abort was requested and must be performed ASAP */
SC_FL_SHUT_WANTED = 0x00004000, /* A shutdown was requested and mux be performed ASAP */
SC_FL_ABRT_DONE = 0x00008000, /* An abort was performed for the SC */
- SC_FL_SHUTW = 0x00010000, /* SC must shut down for writes ASAP */
+ SC_FL_SHUT_DONE = 0x00010000, /* A shutdown was performed for the SC */
};
/* This function is used to report flags in debugging tools. Please reflect
_(SC_FL_DONT_WAKE, _(SC_FL_INDEP_STR, _(SC_FL_WONT_READ,
_(SC_FL_NEED_BUFF, _(SC_FL_NEED_ROOM,
_(SC_FL_RCV_ONCE, _(SC_FL_SND_ASAP, _(SC_FL_SND_NEVERWAIT, _(SC_FL_SND_EXP_MORE,
- _(SC_FL_ABRT_WANTED, _(SC_FL_SHUT_WANTED, _(SC_FL_ABRT_DONE, _(SC_FL_SHUTW)))))))))))))))));
+ _(SC_FL_ABRT_WANTED, _(SC_FL_SHUT_WANTED, _(SC_FL_ABRT_DONE, _(SC_FL_SHUT_DONE)))))))))))))))));
/* epilogue */
_(~0U);
return buf;
int i, j, max;
/* FIXME: Don't watch the other side ! */
- if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+ if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
return 1;
chunk_reset(&trash);
int i, max;
/* FIXME: Don't watch the other side ! */
- if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+ if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
return 1;
/* It's not possible to scan queues in small chunks and yield in the
int thr;
/* FIXME: Don't watch the other side ! */
- if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+ if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
return 1;
chunk_reset(&trash);
static int back_may_abort_req(struct channel *req, struct stream *s)
{
return (sc_ep_test(s->scf, SE_FL_ERROR) ||
- ((chn_cons(req)->flags & (SC_FL_SHUT_WANTED|SC_FL_SHUTW)) && /* empty and client aborted */
+ ((chn_cons(req)->flags & (SC_FL_SHUT_WANTED|SC_FL_SHUT_DONE)) && /* empty and client aborted */
(channel_is_empty(req) || (s->be->options & PR_O_ABRT_CLOSE))));
}
DBG_TRACE_ENTER(STRM_EV_STRM_PROC|STRM_EV_CS_ST, s);
/* the client might want to abort */
- if ((chn_cons(rep)->flags & SC_FL_SHUTW) ||
+ if ((chn_cons(rep)->flags & SC_FL_SHUT_DONE) ||
((chn_cons(req)->flags & SC_FL_SHUT_WANTED) &&
(channel_is_empty(req) || (s->be->options & PR_O_ABRT_CLOSE)))) {
sc->flags |= SC_FL_NOLINGER;
*/
if (!(req->flags & CF_WROTE_DATA)) {
/* client abort ? */
- if ((chn_cons(rep)->flags & SC_FL_SHUTW) ||
+ if ((chn_cons(rep)->flags & SC_FL_SHUT_DONE) ||
((chn_cons(req)->flags & SC_FL_SHUT_WANTED) &&
(channel_is_empty(req) || (s->be->options & PR_O_ABRT_CLOSE)))) {
/* give up */
max = len;
/* closed or empty + imminent close = -1; empty = 0 */
- if (unlikely((chn_cons(chn)->flags & SC_FL_SHUTW) || channel_is_empty(chn))) {
- if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))
+ if (unlikely((chn_cons(chn)->flags & SC_FL_SHUT_DONE) || channel_is_empty(chn))) {
+ if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))
ret = -1;
goto out;
}
if (ret > 0 && ret < len &&
(ret < co_data(chn) || channel_may_recv(chn)) &&
!found &&
- !(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)))
+ !(chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)))
ret = 0;
out:
if (max)
max = len;
/* closed or empty + imminent close = -1; empty = 0 */
- if (unlikely((chn_cons(chn)->flags & SC_FL_SHUTW) || channel_is_empty(chn))) {
- if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))
+ if (unlikely((chn_cons(chn)->flags & SC_FL_SHUT_DONE) || channel_is_empty(chn))) {
+ if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))
ret = -1;
goto out;
}
if (ret > 0 && ret < len &&
(ret < co_data(chn) || channel_may_recv(chn)) &&
*(str-1) != sep &&
- !(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)))
+ !(chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)))
ret = 0;
out:
if (max)
max = len;
/* closed or empty + imminent close = -1; empty = 0 */
- if (unlikely((chn_cons(chn)->flags & SC_FL_SHUTW) || channel_is_empty(chn))) {
- if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))
+ if (unlikely((chn_cons(chn)->flags & SC_FL_SHUT_DONE) || channel_is_empty(chn))) {
+ if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))
ret = -1;
goto out;
}
if (ret > 0 && ret < len &&
(ret < co_data(chn) || channel_may_recv(chn)) &&
*(str-1) != '\n' &&
- !(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)))
+ !(chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)))
ret = 0;
out:
if (max)
*/
int co_getchar(const struct channel *chn, char *c)
{
- if (chn_cons(chn)->flags & SC_FL_SHUTW)
+ if (chn_cons(chn)->flags & SC_FL_SHUT_DONE)
return -1;
if (unlikely(co_data(chn) == 0)) {
- if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))
+ if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))
return -1;
return 0;
}
*/
int co_getblk(const struct channel *chn, char *blk, int len, int offset)
{
- if (chn_cons(chn)->flags & SC_FL_SHUTW)
+ if (chn_cons(chn)->flags & SC_FL_SHUT_DONE)
return -1;
if (len + offset > co_data(chn) || co_data(chn) == 0) {
- if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))
+ if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))
return -1;
return 0;
}
int co_getblk_nc(const struct channel *chn, const char **blk1, size_t *len1, const char **blk2, size_t *len2)
{
if (unlikely(co_data(chn) == 0)) {
- if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))
+ if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))
return -1;
return 0;
}
}
}
- if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) {
+ if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) {
/* If we have found no LF and the buffer is shut, then
* the resulting string is made of the concatenation of
* the pending blocks (1 or 2).
}
}
- if (chn_cons(chn)->flags & SC_FL_SHUTW) {
+ if (chn_cons(chn)->flags & SC_FL_SHUT_DONE) {
/* If we have found no LF and the buffer is shut, then
* the resulting string is made of the concatenation of
* the pending blocks (1 or 2).
char **var = ctx->var;
/* FIXME: Don't watch the other side !*/
- if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+ if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
return 1;
chunk_reset(&trash);
int ret = 1;
/* FIXME: Don't watch the other side !*/
- if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+ if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
goto end;
chunk_reset(&trash);
send_status:
s->pcli_flags |= PCLI_F_RELOAD;
- /* dont' use ci_putblk here because SHUTW could have been sent */
+ /* dont' use ci_putblk here because SHUT_DONE could have been sent */
b_reset(&req->buf);
b_putblk(&req->buf, "_loadstatus;quit\n", 17);
goto read_again;
struct proxy *be = s->be;
if (sc_ep_test(s->scb, SE_FL_ERR_PENDING|SE_FL_ERROR) || (rep->flags & (CF_READ_TIMEOUT|CF_WRITE_TIMEOUT)) ||
- ((chn_cons(rep)->flags & SC_FL_SHUTW) && (rep->to_forward || co_data(rep)))) {
+ ((chn_cons(rep)->flags & SC_FL_SHUT_DONE) && (rep->to_forward || co_data(rep)))) {
pcli_reply_and_close(s, "Can't connect to the target CLI!\n");
s->req.analysers &= ~AN_REQ_WAIT_CLI;
s->res.analysers &= ~AN_RES_WAIT_CLI;
sockaddr_free(&s->scb->dst);
sc_set_state(s->scb, SC_ST_INI);
- s->scb->flags &= ~(SC_FL_SHUTW|SC_FL_SHUT_WANTED);
+ s->scb->flags &= ~(SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED);
s->scb->flags &= SC_FL_ISBACK | SC_FL_DONT_WAKE; /* we're in the context of process_stream */
s->req.flags &= ~(CF_AUTO_CONNECT|CF_STREAMER|CF_STREAMER_FAST|CF_WROTE_DATA);
int thr;
/* FIXME: Don't watch the other side !*/
- if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+ if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
return 1;
if (appctx->st0)
int i, fd;
/* FIXME: Don't watch the other side !*/
- if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+ if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
goto end;
chunk_reset(&trash);
int ret = 1;
/* FIXME: Don't watch the other side !*/
- if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+ if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
goto end;
if (!ctx->width) {
* - the input in closed and no data is pending
* - There is a READ/WRITE timeout
*/
- if (chn_cons(chn)->flags & SC_FL_SHUTW) {
+ if (chn_cons(chn)->flags & SC_FL_SHUT_DONE) {
ret = 1;
goto end;
}
if (!(txn->flags & TX_CON_WANT_TUN))
channel_dont_close(req);
- if ((chn_cons(req)->flags & SC_FL_SHUTW) && co_data(req)) {
+ if ((chn_cons(req)->flags & SC_FL_SHUT_DONE) && co_data(req)) {
/* request errors are most likely due to the server aborting the
* transfer. */
goto return_srv_abort;
waiting:
/* waiting for the last bits to leave the buffer */
- if (chn_cons(req)->flags & SC_FL_SHUTW)
+ if (chn_cons(req)->flags & SC_FL_SHUT_DONE)
goto return_srv_abort;
/* When TE: chunked is used, we need to get there again to parse remaining
res->analyse_exp = TICK_ETERNITY;
res->total = 0;
- s->scb->flags &= ~(SC_FL_SHUTW|SC_FL_SHUT_WANTED);
+ s->scb->flags &= ~(SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED);
if (sc_reset_endp(s->scb) < 0) {
if (!(s->flags & SF_ERR_MASK))
s->flags |= SF_ERR_INTERNAL;
/* 3: client abort with an abortonclose */
else if ((chn_prod(rep)->flags & SC_FL_ABRT_DONE) &&
(chn_prod(&s->req)->flags & SC_FL_ABRT_DONE) &&
- (chn_cons(&s->req)->flags & SC_FL_SHUTW)) {
+ (chn_cons(&s->req)->flags & SC_FL_SHUT_DONE)) {
_HA_ATOMIC_INC(&sess->fe->fe_counters.cli_aborts);
_HA_ATOMIC_INC(&s->be->be_counters.cli_aborts);
if (sess->listener && sess->listener->counters)
channel_dont_close(res);
- if ((chn_cons(res)->flags & SC_FL_SHUTW) && co_data(res)) {
+ if ((chn_cons(res)->flags & SC_FL_SHUT_DONE) && co_data(res)) {
/* response errors are most likely due to the client aborting
* the transfer. */
goto return_cli_abort;
return 0;
missing_data_or_waiting:
- if (chn_cons(res)->flags & SC_FL_SHUTW)
+ if (chn_cons(res)->flags & SC_FL_SHUT_DONE)
goto return_cli_abort;
/* stop waiting for data if the input is closed before the end. If the
*/
if (msg->msg_state < HTTP_MSG_ENDING && (chn_prod(res)->flags & SC_FL_ABRT_DONE)) {
if ((chn_prod(&s->req)->flags & SC_FL_ABRT_DONE) &&
- (chn_cons(&s->req)->flags & SC_FL_SHUTW))
+ (chn_cons(&s->req)->flags & SC_FL_SHUT_DONE))
goto return_cli_abort;
/* If we have some pending data, we continue the processing */
if (htx_is_empty(htx))
txn->rsp.msg_state != HTTP_MSG_CLOSED)
goto check_channel_flags;
- if (!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))) {
+ if (!(chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))) {
sc_schedule_abort(s->scf);
sc_schedule_shutdown(s->scb);
}
check_channel_flags:
/* Here, we are in HTTP_MSG_DONE or HTTP_MSG_TUNNEL */
- if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) {
+ if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) {
/* if we've just closed an output, let's switch */
txn->req.msg_state = HTTP_MSG_CLOSING;
goto http_msg_closing;
/* we're not expecting any new data to come for this
* transaction, so we can close it.
*/
- if (!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))) {
+ if (!(chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))) {
sc_schedule_abort(s->scb);
sc_schedule_shutdown(s->scf);
}
check_channel_flags:
/* Here, we are in HTTP_MSG_DONE or HTTP_MSG_TUNNEL */
- if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) {
+ if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) {
/* if we've just closed an output, let's switch */
txn->rsp.msg_state = HTTP_MSG_CLOSING;
goto http_msg_closing;
struct pat_ref_elt *elt;
/* FIXME: Don't watch the other side !*/
- if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW)) {
+ if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE)) {
/* If we're forced to shut down, we might have to remove our
* reference to the last ref_elt being dumped.
*/
char *reloadtxt = NULL;
/* FIXME: Don't watch the other side !*/
- if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+ if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
return 1;
if (up < 0) /* must never be negative because of clock drift */
return 1;
/* FIXME: Don't watch the other side !*/
- if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+ if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
return 1;
env = getenv("HAPROXY_LOAD_SUCCESS");
extern const char *monthname[12];
/* FIXME: Don't watch the other side !*/
- if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+ if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
return 1;
chunk_reset(&trash);
goto done;
/* FIXME: Don't watch the other side !*/
- if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW)) {
+ if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE)) {
/* If we're forced to shut down, we might have to remove our
* reference to the last stream being dumped.
*/
int ret;
/* FIXME: Don't watch the other side !*/
- if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+ if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
return 1;
HA_RWLOCK_WRLOCK(LOGSRV_LOCK, &ring->lock);
/* we've drained everything and are configured to wait for more
* data or an event (keypress, close)
*/
- if (!sc_oc(sc)->output && !(sc->flags & SC_FL_SHUTW)) {
+ if (!sc_oc(sc)->output && !(sc->flags & SC_FL_SHUT_DONE)) {
/* let's be woken up once new data arrive */
HA_RWLOCK_WRLOCK(LOGSRV_LOCK, &ring->lock);
LIST_APPEND(&ring->waiters, &appctx->wait_entry);
struct ckch_inst *ckchi;
/* FIXME: Don't watch the other side !*/
- if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+ if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
goto end;
while (1) {
char *path;
/* FIXME: Don't watch the other side !*/
- if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+ if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
goto end;
/* The ctx was already validated by the ca-file/crl-file parsing
* created.
*/
/* FIXME: Don't watch the other side !*/
- if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW))
+ if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE))
goto end;
switch (ctx->state) {
if (!sc_state_in(sc->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST))
return;
- if (sc->flags & SC_FL_SHUTW) {
+ if (sc->flags & SC_FL_SHUT_DONE) {
sc->state = SC_ST_DIS;
if (sc->flags & SC_FL_ISBACK)
__sc_strm(sc)->conn_exp = TICK_ETERNITY;
struct channel *oc = sc_oc(sc);
sc->flags &= ~SC_FL_SHUT_WANTED;
- if (sc->flags & SC_FL_SHUTW)
+ if (sc->flags & SC_FL_SHUT_DONE)
return;
- sc->flags |= SC_FL_SHUTW;
+ sc->flags |= SC_FL_SHUT_DONE;
oc->flags |= CF_WRITE_EVENT;
sc_set_hcto(sc);
{
struct channel *oc = sc_oc(sc);
- if (unlikely(sc->state != SC_ST_EST || (sc->flags & SC_FL_SHUTW)))
+ if (unlikely(sc->state != SC_ST_EST || (sc->flags & SC_FL_SHUT_DONE)))
return;
if (!sc_ep_test(sc, SE_FL_WAIT_DATA) || /* not waiting for data */
if (!sc_state_in(sc->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST))
return;
- if (sc->flags & SC_FL_SHUTW) {
+ if (sc->flags & SC_FL_SHUT_DONE) {
sc_conn_shut(sc);
sc->state = SC_ST_DIS;
if (sc->flags & SC_FL_ISBACK)
BUG_ON(!sc_conn(sc));
sc->flags &= ~SC_FL_SHUT_WANTED;
- if (sc->flags & SC_FL_SHUTW)
+ if (sc->flags & SC_FL_SHUT_DONE)
return;
- sc->flags |= SC_FL_SHUTW;
+ sc->flags |= SC_FL_SHUT_DONE;
oc->flags |= CF_WRITE_EVENT;
sc_set_hcto(sc);
BUG_ON(!sc_conn(sc));
if (unlikely(!sc_state_in(sc->state, SC_SB_RDY|SC_SB_EST) ||
- (sc->flags & SC_FL_SHUTW)))
+ (sc->flags & SC_FL_SHUT_DONE)))
return;
if (unlikely(channel_is_empty(oc))) /* called with nothing to send ! */
* chunk and need to close.
*/
if ((oc->flags & CF_AUTO_CLOSE) &&
- ((sc->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED) &&
+ ((sc->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED) &&
sc_state_in(sc->state, SC_SB_RDY|SC_SB_EST)) {
sc_shutw(sc);
goto out_wakeup;
}
- if ((sc->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) == 0)
+ if ((sc->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) == 0)
sc_ep_set(sc, SE_FL_WAIT_DATA);
}
else {
/* in case of special condition (error, shutdown, end of write...), we
* have to notify the task.
*/
- if (likely((sc->flags & SC_FL_SHUTW) ||
+ if (likely((sc->flags & SC_FL_SHUT_DONE) ||
((oc->flags & CF_WRITE_EVENT) && sc->state < SC_ST_EST) ||
((oc->flags & CF_WAKE_WRITE) &&
((channel_is_empty(oc) && !oc->to_forward) ||
if (!sc_state_in(sc->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST))
return;
- if (sc->flags & SC_FL_SHUTW) {
+ if (sc->flags & SC_FL_SHUT_DONE) {
appctx_shut(__sc_appctx(sc));
sc->state = SC_ST_DIS;
if (sc->flags & SC_FL_ISBACK)
BUG_ON(!sc_appctx(sc));
sc->flags &= ~SC_FL_SHUT_WANTED;
- if (sc->flags & SC_FL_SHUTW)
+ if (sc->flags & SC_FL_SHUT_DONE)
return;
- sc->flags |= SC_FL_SHUTW;
+ sc->flags |= SC_FL_SHUT_DONE;
oc->flags |= CF_WRITE_EVENT;
sc_set_hcto(sc);
BUG_ON(!sc_appctx(sc));
- if (unlikely(sc->state != SC_ST_EST || (sc->flags & SC_FL_SHUTW)))
+ if (unlikely(sc->state != SC_ST_EST || (sc->flags & SC_FL_SHUT_DONE)))
return;
/* we only wake the applet up if it was waiting for some data and is ready to consume it */
{
struct channel *oc = sc_oc(sc);
- if (sc->flags & SC_FL_SHUTW)
+ if (sc->flags & SC_FL_SHUT_DONE)
return;
/* Write not closed, update FD status and timeout for writes */
if (channel_is_empty(oc)) {
struct connection *conn = sc_conn(sc);
- if (((sc->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED) &&
+ if (((sc->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED) &&
(sc->state == SC_ST_EST) && (!conn || !(conn->flags & (CO_FL_WAIT_XPRT | CO_FL_EARLY_SSL_HS))))
sc_shutw(sc);
}
/* indicate that we may be waiting for data from the output channel or
* we're about to close and can't expect more data if SC_FL_SHUT_WANTED is there.
*/
- if (!(sc->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)))
+ if (!(sc->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)))
sc_ep_set(sc, SE_FL_WAIT_DATA);
- else if ((sc->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED)
+ else if ((sc->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED)
sc_ep_clr(sc, SE_FL_WAIT_DATA);
if (oc->flags & CF_DONT_READ)
sc_ep_test(sc, SE_FL_ERR_PENDING) ||
((oc->flags & CF_WRITE_EVENT) &&
((sc->state < SC_ST_EST) ||
- (sc->flags & SC_FL_SHUTW) ||
+ (sc->flags & SC_FL_SHUT_DONE) ||
(((oc->flags & CF_WAKE_WRITE) ||
(!(oc->flags & CF_AUTO_CLOSE) &&
- !(sc->flags & (SC_FL_SHUT_WANTED|SC_FL_SHUTW)))) &&
+ !(sc->flags & (SC_FL_SHUT_WANTED|SC_FL_SHUT_DONE)))) &&
(sco->state != SC_ST_EST ||
(channel_is_empty(oc) && !oc->to_forward)))))) {
task_wakeup(task, TASK_WOKEN_IO);
if (!sc_state_in(sc->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST))
return;
- if (sc->flags & SC_FL_SHUTW)
+ if (sc->flags & SC_FL_SHUT_DONE)
goto do_close;
if (sc_cond_forward_shutw(sc)) {
sc_conn_shut(sc);
sc->flags &= ~SC_FL_SHUT_WANTED;
- sc->flags |= SC_FL_SHUTW;
+ sc->flags |= SC_FL_SHUT_DONE;
sc->state = SC_ST_DIS;
if (sc->flags & SC_FL_ISBACK)
cur_read += ret;
/* if we're allowed to directly forward data, we must update ->o */
- if (ic->to_forward && !(chn_cons(ic)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))) {
+ if (ic->to_forward && !(chn_cons(ic)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))) {
unsigned long fwd = ret;
if (ic->to_forward != CHN_INFINITE_FORWARD) {
if (fwd > ic->to_forward)
return 0;
/* we might have been called just after an asynchronous shutw */
- if (sc->flags & SC_FL_SHUTW)
+ if (sc->flags & SC_FL_SHUT_DONE)
return 1;
/* we must wait because the mux is not installed yet */
oc->flags &= ~CF_WRITE_EVENT;
- if (sc->flags & SC_FL_SHUTW)
+ if (sc->flags & SC_FL_SHUT_DONE)
return;
if (channel_is_empty(oc))
* data though.
*/
/* FIXME: Don't watch the other side !*/
- if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW)) {
+ if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE)) {
/* in case of abort, remove any refcount we might have set on an entry */
if (ctx->state == STATE_DUMP) {
stksess_kill_if_expired(ctx->t, ctx->entry, 1);
}
/* If we managed to get the whole response, and we don't have anything
* left to send, or can't, switch to SC_ST_DIS now. */
- if ((s->scb->flags & SC_FL_ABRT_DONE) || (s->scf->flags & SC_FL_SHUTW)) {
+ if ((s->scb->flags & SC_FL_ABRT_DONE) || (s->scf->flags & SC_FL_SHUT_DONE)) {
s->scb->state = SC_ST_DIS;
DBG_TRACE_STATE("response channel shutdwn for read/write", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s);
}
sc_check_timeouts(s->scb);
channel_check_timeout(&s->res);
- if (unlikely(!(s->scb->flags & SC_FL_SHUTW) && (s->req.flags & CF_WRITE_TIMEOUT))) {
+ if (unlikely(!(s->scb->flags & SC_FL_SHUT_DONE) && (s->req.flags & CF_WRITE_TIMEOUT))) {
s->scb->flags |= SC_FL_NOLINGER;
sc_shutw(s->scb);
}
s->scf->flags |= SC_FL_NOLINGER;
sc_abort(s->scf);
}
- if (unlikely(!(s->scf->flags & SC_FL_SHUTW) && (s->res.flags & CF_WRITE_TIMEOUT))) {
+ if (unlikely(!(s->scf->flags & SC_FL_SHUT_DONE) && (s->res.flags & CF_WRITE_TIMEOUT))) {
s->scf->flags |= SC_FL_NOLINGER;
sc_shutw(s->scf);
}
* So let's not run a whole stream processing if only an expiration
* timeout needs to be refreshed.
*/
- if (!((scf->flags | scb->flags) & (SC_FL_ABRT_DONE|SC_FL_SHUTW)) &&
+ if (!((scf->flags | scb->flags) & (SC_FL_ABRT_DONE|SC_FL_SHUT_DONE)) &&
!((req->flags | res->flags) & (CF_READ_EVENT|CF_READ_TIMEOUT|CF_WRITE_EVENT|CF_WRITE_TIMEOUT)) &&
!(s->flags & SF_CONN_EXP) &&
!((sc_ep_get(scf) | sc_ep_get(scb)) & SE_FL_ERROR) &&
/* Analyse request */
if (((req->flags & ~rqf_last) & CF_MASK_ANALYSER) ||
((scf->flags ^ scf_flags) & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) ||
- ((scb->flags ^ scb_flags) & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) ||
- (req->analysers && (chn_cons(req)->flags & SC_FL_SHUTW)) ||
+ ((scb->flags ^ scb_flags) & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) ||
+ (req->analysers && (chn_cons(req)->flags & SC_FL_SHUT_DONE)) ||
scf->state != rq_prod_last ||
scb->state != rq_cons_last ||
s->pending_events & TASK_WOKEN_MSG) {
req->flags &= ~CF_WAKE_ONCE;
rqf_last = req->flags;
scf_flags = (scf_flags & ~(SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) | (scf->flags & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED));
- scb_flags = (scb_flags & ~(SC_FL_SHUTW|SC_FL_SHUT_WANTED)) | (scb->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED));
+ scb_flags = (scb_flags & ~(SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) | (scb->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED));
- if (((scf->flags ^ scf_flags_ana) & SC_FL_ABRT_DONE) || ((scb->flags ^ scb_flags_ana) & SC_FL_SHUTW))
+ if (((scf->flags ^ scf_flags_ana) & SC_FL_ABRT_DONE) || ((scb->flags ^ scb_flags_ana) & SC_FL_SHUT_DONE))
goto resync_request;
}
if (((res->flags & ~rpf_last) & CF_MASK_ANALYSER) ||
((scb->flags ^ scb_flags) & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) ||
- ((scf->flags ^ scf_flags) & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) ||
- (res->analysers && (chn_cons(res)->flags & SC_FL_SHUTW)) ||
+ ((scf->flags ^ scf_flags) & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) ||
+ (res->analysers && (chn_cons(res)->flags & SC_FL_SHUT_DONE)) ||
scf->state != rp_cons_last ||
scb->state != rp_prod_last ||
s->pending_events & TASK_WOKEN_MSG) {
res->flags &= ~CF_WAKE_ONCE;
rpf_last = res->flags;
scb_flags = (scb_flags & ~(SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) | (scb->flags & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED));
- scf_flags = (scf_flags & ~(SC_FL_SHUTW|SC_FL_SHUT_WANTED)) | (scf->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED));
+ scf_flags = (scf_flags & ~(SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) | (scf->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED));
- if (((scb->flags ^ scb_flags_ana) & SC_FL_ABRT_DONE) || ((scf->flags ^ scf_flags_ana) & SC_FL_SHUTW))
+ if (((scb->flags ^ scb_flags_ana) & SC_FL_ABRT_DONE) || ((scf->flags ^ scf_flags_ana) & SC_FL_SHUT_DONE))
goto resync_response;
}
* recent call to channel_abort().
*/
if (unlikely((!req->analysers || (req->analysers == AN_REQ_FLT_END && !(req->flags & CF_FLT_ANALYZE))) &&
- !(scf->flags & SC_FL_ABRT_WANTED) && !(scb->flags & SC_FL_SHUTW) &&
+ !(scf->flags & SC_FL_ABRT_WANTED) && !(scb->flags & SC_FL_SHUT_DONE) &&
(sc_state_in(scf->state, SC_SB_EST|SC_SB_DIS|SC_SB_CLO)) &&
(req->to_forward != CHN_INFINITE_FORWARD))) {
/* This buffer is freewheeling, there's no analyser
/* reflect what the L7 analysers have seen last */
rqf_last = req->flags;
scf_flags = (scf_flags & ~(SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) | (scf->flags & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED));
- scb_flags = (scb_flags & ~(SC_FL_SHUTW|SC_FL_SHUT_WANTED)) | (scb->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED));
+ scb_flags = (scb_flags & ~(SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) | (scb->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED));
/* it's possible that an upper layer has requested a connection setup or abort.
* There are 2 situations where we decide to establish a new connection :
* - the CF_AUTO_CONNECT flag is set (active connection)
*/
if (scb->state == SC_ST_INI) {
- if (!(scb->flags & SC_FL_SHUTW)) {
+ if (!(scb->flags & SC_FL_SHUT_DONE)) {
if ((req->flags & CF_AUTO_CONNECT) || !channel_is_empty(req)) {
/* If we have an appctx, there is no connect method, so we
* immediately switch to the connected state, otherwise we
* connection setup unless the backend has abortonclose set.
*/
if (unlikely((req->flags & CF_AUTO_CLOSE) && (scf->flags & SC_FL_ABRT_DONE) &&
- !(scb->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) &&
+ !(scb->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) &&
(scb->state != SC_ST_CON || (s->be->options & PR_O_ABRT_CLOSE)))) {
sc_schedule_shutdown(scb);
}
/* shutdown(write) pending */
- if (unlikely((scb->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED &&
+ if (unlikely((scb->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED &&
channel_is_empty(req))) {
if (sc_ep_test(s->scf, SE_FL_ERROR))
scb->flags |= SC_FL_NOLINGER;
}
/* shutdown(write) done on server side, we must stop the client too */
- if (unlikely((scb->flags & SC_FL_SHUTW) && !(scf->flags & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED))) &&
+ if (unlikely((scb->flags & SC_FL_SHUT_DONE) && !(scf->flags & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED))) &&
!req->analysers)
sc_schedule_abort(scf);
goto resync_stconns;
/* otherwise we want to check if we need to resync the req buffer or not */
- if (((scf->flags ^ scf_flags) & SC_FL_ABRT_DONE) || ((scb->flags ^ scb_flags) & SC_FL_SHUTW))
+ if (((scf->flags ^ scf_flags) & SC_FL_ABRT_DONE) || ((scb->flags ^ scb_flags) & SC_FL_SHUT_DONE))
goto resync_request;
/* perform output updates to the response buffer */
if (!req->analysers && s->tunnel_timeout) {
scf->ioto = scb->ioto = s->tunnel_timeout;
- if ((scf->flags & (SC_FL_ABRT_DONE|SC_FL_SHUTW)) && tick_isset(sess->fe->timeout.clientfin))
+ if ((scf->flags & (SC_FL_ABRT_DONE|SC_FL_SHUT_DONE)) && tick_isset(sess->fe->timeout.clientfin))
scf->ioto = sess->fe->timeout.clientfin;
- if ((scb->flags & (SC_FL_ABRT_DONE|SC_FL_SHUTW)) && tick_isset(s->be->timeout.serverfin))
+ if ((scb->flags & (SC_FL_ABRT_DONE|SC_FL_SHUT_DONE)) && tick_isset(s->be->timeout.serverfin))
scb->ioto = s->be->timeout.serverfin;
}
}
/* reflect what the L7 analysers have seen last */
rpf_last = res->flags;
scb_flags = (scb_flags & ~(SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) | (scb->flags & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED));
- scf_flags = (scf_flags & ~(SC_FL_SHUTW|SC_FL_SHUT_WANTED)) | (scf->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED));
+ scf_flags = (scf_flags & ~(SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) | (scf->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED));
/* Let's see if we can send the pending response now */
sc_conn_sync_send(scf);
/* first, let's check if the response buffer needs to shutdown(write) */
if (unlikely((res->flags & CF_AUTO_CLOSE) && (scb->flags & SC_FL_ABRT_DONE) &&
- !(scf->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)))) {
+ !(scf->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)))) {
sc_schedule_shutdown(scf);
}
/* shutdown(write) pending */
- if (unlikely((scf->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED &&
+ if (unlikely((scf->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED &&
channel_is_empty(res))) {
sc_shutw(scf);
}
/* shutdown(write) done on the client side, we must stop the server too */
- if (unlikely((scf->flags & SC_FL_SHUTW) && !(scb->flags & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED))) &&
+ if (unlikely((scf->flags & SC_FL_SHUT_DONE) && !(scb->flags & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED))) &&
!res->analysers)
sc_schedule_abort(scb);
goto resync_request;
if (((scb->flags ^ scb_flags) & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) ||
- ((scf->flags ^ scf_flags) & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)))
+ ((scf->flags ^ scf_flags) & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)))
goto resync_response;
if (((req->flags ^ rqf_last) | (res->flags ^ rpf_last)) & CF_MASK_ANALYSER)
/* kill a stream and set the termination flags to <why> (one of SF_ERR_*) */
void stream_shutdown(struct stream *stream, int why)
{
- if (stream->scb->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))
+ if (stream->scb->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))
return;
sc_schedule_shutdown(stream->scb);
}
/* FIXME: Don't watch the other side !*/
- if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUTW)) {
+ if (unlikely(sc_opposite(sc)->flags & SC_FL_SHUT_DONE)) {
/* If we're forced to shut down, we might have to remove our
* reference to the last stream being dumped.
*/