channel_erase(chn);
}
-/* marks the channel as "shutdown" ASAP for writes */
-static inline void channel_shutw_now(struct channel *chn)
-{
- chn_cons(chn)->flags |= SC_FL_SHUT_WANTED;
-}
/* marks the channel as "shutdown" ASAP in both directions */
static inline void channel_abort(struct channel *chn)
sc->flags |= SC_FL_ABRT_WANTED;
}
+/* Schedule a shutdown for the SC */
+static inline void sc_schedule_shutdown(struct stconn *sc)
+{
+ sc->flags |= SC_FL_SHUT_WANTED;
+}
+
#endif /* _HAPROXY_SC_STRM_H */
} else if (strcmp("quit", args[0]) == 0) {
sc_schedule_abort(s->scf);
- channel_shutw_now(&s->res);
+ sc_schedule_shutdown(s->scf);
return argl; /* return the number of elements in the array */
} else if (strcmp(args[0], "operator") == 0) {
if (!pcli_has_level(s, ACCESS_LVL_OPER)) {
if (!(s->pcli_flags & PCLI_F_PAYLOAD)) {
/* we send only 1 command per request, and we write close after it */
- channel_shutw_now(req);
+ sc_schedule_shutdown(s->scb);
} else {
pcli_write_prompt(s);
}
if (chn_prod(req)->flags & SC_FL_SHUTR) {
/* There is no more request or a only a partial one and we
* receive a close from the client, we can leave */
- channel_shutw_now(&s->res);
+ sc_schedule_shutdown(s->scf);
s->req.analysers &= ~AN_REQ_WAIT_CLI;
return 1;
}
if (!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))) {
sc_schedule_abort(s->scf);
- channel_shutw_now(chn);
+ sc_schedule_shutdown(s->scb);
}
}
goto check_channel_flags;
if (txn->req.msg_state == HTTP_MSG_CLOSING) {
http_msg_closing:
/* nothing else to forward, just waiting for the output buffer
- * to be empty and for the shutw_now to take effect.
+ * to be empty and for the shut_wanted to take effect.
*/
if (channel_is_empty(chn)) {
txn->req.msg_state = HTTP_MSG_CLOSED;
*/
if (!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))) {
sc_schedule_abort(s->scb);
- channel_shutw_now(chn);
+ sc_schedule_shutdown(s->scf);
}
}
goto check_channel_flags;
if (txn->rsp.msg_state == HTTP_MSG_CLOSING) {
http_msg_closing:
/* nothing else to forward, just waiting for the output buffer
- * to be empty and for the shutw_now to take effect.
+ * to be empty and for the shut_wanted to take effect.
*/
if (channel_is_empty(chn)) {
txn->rsp.msg_state = HTTP_MSG_CLOSED;
return 0;
if (!channel_is_empty(sc_ic(sc))) {
- /* the close to the write side cannot be forwarded now because
+ /* the shutdown cannot be forwarded now because
* we should flush outgoing data first. But instruct the output
* channel it should be done ASAP.
*/
- channel_shutw_now(sc_oc(sc));
+ sc_schedule_shutdown(sc);
return 0;
}
if (sc_ep_test(sc, SE_FL_EOS)) {
/* we received a shutdown */
if (ic->flags & CF_AUTO_CLOSE)
- channel_shutw_now(ic);
+ sc_schedule_shutdown(sc_opposite(sc));
sc_conn_read0(sc);
ret = 1;
}
if (sc_ep_test(sc, SE_FL_EOS) && !(sc->flags & SC_FL_SHUTR)) {
/* we received a shutdown */
if (ic->flags & CF_AUTO_CLOSE)
- channel_shutw_now(ic);
+ sc_schedule_shutdown(sc_opposite(sc));
sc_conn_read0(sc);
}
}
else {
s->scb->state = SC_ST_CLO; /* shutw+ini = abort */
- channel_shutw_now(req); /* fix buffer flags upon abort */
+ sc_schedule_shutdown(scb);
sc_schedule_abort(scb);
}
}
if (unlikely((req->flags & CF_AUTO_CLOSE) && (scf->flags & SC_FL_SHUTR) &&
!(scb->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) &&
(scb->state != SC_ST_CON || (s->be->options & PR_O_ABRT_CLOSE)))) {
- channel_shutw_now(req);
+ sc_schedule_shutdown(scb);
}
/* shutdown(write) pending */
/* first, let's check if the response buffer needs to shutdown(write) */
if (unlikely((res->flags & CF_AUTO_CLOSE) && (scb->flags & SC_FL_SHUTR) &&
!(scf->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)))) {
- channel_shutw_now(res);
+ sc_schedule_shutdown(scf);
}
/* shutdown(write) pending */
if (stream->scb->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))
return;
- channel_shutw_now(&stream->req);
+ sc_schedule_shutdown(stream->scb);
sc_schedule_abort(stream->scb);
stream->task->nice = 1024;
if (!(stream->flags & SF_ERR_MASK))