mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-10 00:57:02 +02:00
MINOR: channel/stconn: Replace channel_shutw_now() by sc_schedule_shutdown()
After the flag renaming, it is now the turn for the channel function to be renamed and moved in the SC scope. channel_shutw_now() is replaced by sc_schedule_shutdown(). The request channel is replaced by the front SC and the response is replace by the back SC.
This commit is contained in:
parent
e38534cbd0
commit
df7cd710a8
@ -548,11 +548,6 @@ static inline void channel_htx_erase(struct channel *chn, struct htx *htx)
|
|||||||
channel_erase(chn);
|
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 */
|
/* marks the channel as "shutdown" ASAP in both directions */
|
||||||
static inline void channel_abort(struct channel *chn)
|
static inline void channel_abort(struct channel *chn)
|
||||||
|
@ -420,4 +420,10 @@ static inline void sc_schedule_abort(struct stconn *sc)
|
|||||||
sc->flags |= SC_FL_ABRT_WANTED;
|
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 */
|
#endif /* _HAPROXY_SC_STRM_H */
|
||||||
|
@ -2361,7 +2361,7 @@ int pcli_find_and_exec_kw(struct stream *s, char **args, int argl, char **errmsg
|
|||||||
|
|
||||||
} else if (strcmp("quit", args[0]) == 0) {
|
} else if (strcmp("quit", args[0]) == 0) {
|
||||||
sc_schedule_abort(s->scf);
|
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 */
|
return argl; /* return the number of elements in the array */
|
||||||
} else if (strcmp(args[0], "operator") == 0) {
|
} else if (strcmp(args[0], "operator") == 0) {
|
||||||
if (!pcli_has_level(s, ACCESS_LVL_OPER)) {
|
if (!pcli_has_level(s, ACCESS_LVL_OPER)) {
|
||||||
@ -2640,7 +2640,7 @@ int pcli_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
|||||||
|
|
||||||
if (!(s->pcli_flags & PCLI_F_PAYLOAD)) {
|
if (!(s->pcli_flags & PCLI_F_PAYLOAD)) {
|
||||||
/* we send only 1 command per request, and we write close after it */
|
/* we send only 1 command per request, and we write close after it */
|
||||||
channel_shutw_now(req);
|
sc_schedule_shutdown(s->scb);
|
||||||
} else {
|
} else {
|
||||||
pcli_write_prompt(s);
|
pcli_write_prompt(s);
|
||||||
}
|
}
|
||||||
@ -2695,7 +2695,7 @@ int pcli_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
|||||||
if (chn_prod(req)->flags & SC_FL_SHUTR) {
|
if (chn_prod(req)->flags & SC_FL_SHUTR) {
|
||||||
/* There is no more request or a only a partial one and we
|
/* There is no more request or a only a partial one and we
|
||||||
* receive a close from the client, we can leave */
|
* 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;
|
s->req.analysers &= ~AN_REQ_WAIT_CLI;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -4274,7 +4274,7 @@ static void http_end_request(struct stream *s)
|
|||||||
|
|
||||||
if (!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))) {
|
if (!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))) {
|
||||||
sc_schedule_abort(s->scf);
|
sc_schedule_abort(s->scf);
|
||||||
channel_shutw_now(chn);
|
sc_schedule_shutdown(s->scb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
goto check_channel_flags;
|
goto check_channel_flags;
|
||||||
@ -4283,7 +4283,7 @@ static void http_end_request(struct stream *s)
|
|||||||
if (txn->req.msg_state == HTTP_MSG_CLOSING) {
|
if (txn->req.msg_state == HTTP_MSG_CLOSING) {
|
||||||
http_msg_closing:
|
http_msg_closing:
|
||||||
/* nothing else to forward, just waiting for the output buffer
|
/* 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)) {
|
if (channel_is_empty(chn)) {
|
||||||
txn->req.msg_state = HTTP_MSG_CLOSED;
|
txn->req.msg_state = HTTP_MSG_CLOSED;
|
||||||
@ -4373,7 +4373,7 @@ static void http_end_response(struct stream *s)
|
|||||||
*/
|
*/
|
||||||
if (!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))) {
|
if (!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))) {
|
||||||
sc_schedule_abort(s->scb);
|
sc_schedule_abort(s->scb);
|
||||||
channel_shutw_now(chn);
|
sc_schedule_shutdown(s->scf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
goto check_channel_flags;
|
goto check_channel_flags;
|
||||||
@ -4382,7 +4382,7 @@ static void http_end_response(struct stream *s)
|
|||||||
if (txn->rsp.msg_state == HTTP_MSG_CLOSING) {
|
if (txn->rsp.msg_state == HTTP_MSG_CLOSING) {
|
||||||
http_msg_closing:
|
http_msg_closing:
|
||||||
/* nothing else to forward, just waiting for the output buffer
|
/* 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)) {
|
if (channel_is_empty(chn)) {
|
||||||
txn->rsp.msg_state = HTTP_MSG_CLOSED;
|
txn->rsp.msg_state = HTTP_MSG_CLOSED;
|
||||||
|
@ -511,11 +511,11 @@ static inline int sc_cond_forward_shutw(struct stconn *sc)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!channel_is_empty(sc_ic(sc))) {
|
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
|
* we should flush outgoing data first. But instruct the output
|
||||||
* channel it should be done ASAP.
|
* channel it should be done ASAP.
|
||||||
*/
|
*/
|
||||||
channel_shutw_now(sc_oc(sc));
|
sc_schedule_shutdown(sc);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1484,7 +1484,7 @@ static int sc_conn_recv(struct stconn *sc)
|
|||||||
if (sc_ep_test(sc, SE_FL_EOS)) {
|
if (sc_ep_test(sc, SE_FL_EOS)) {
|
||||||
/* we received a shutdown */
|
/* we received a shutdown */
|
||||||
if (ic->flags & CF_AUTO_CLOSE)
|
if (ic->flags & CF_AUTO_CLOSE)
|
||||||
channel_shutw_now(ic);
|
sc_schedule_shutdown(sc_opposite(sc));
|
||||||
sc_conn_read0(sc);
|
sc_conn_read0(sc);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
@ -1777,7 +1777,7 @@ static int sc_conn_process(struct stconn *sc)
|
|||||||
if (sc_ep_test(sc, SE_FL_EOS) && !(sc->flags & SC_FL_SHUTR)) {
|
if (sc_ep_test(sc, SE_FL_EOS) && !(sc->flags & SC_FL_SHUTR)) {
|
||||||
/* we received a shutdown */
|
/* we received a shutdown */
|
||||||
if (ic->flags & CF_AUTO_CLOSE)
|
if (ic->flags & CF_AUTO_CLOSE)
|
||||||
channel_shutw_now(ic);
|
sc_schedule_shutdown(sc_opposite(sc));
|
||||||
sc_conn_read0(sc);
|
sc_conn_read0(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2308,7 +2308,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
s->scb->state = SC_ST_CLO; /* shutw+ini = abort */
|
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);
|
sc_schedule_abort(scb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2367,7 +2367,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
|||||||
if (unlikely((req->flags & CF_AUTO_CLOSE) && (scf->flags & SC_FL_SHUTR) &&
|
if (unlikely((req->flags & CF_AUTO_CLOSE) && (scf->flags & SC_FL_SHUTR) &&
|
||||||
!(scb->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) &&
|
!(scb->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) &&
|
||||||
(scb->state != SC_ST_CON || (s->be->options & PR_O_ABRT_CLOSE)))) {
|
(scb->state != SC_ST_CON || (s->be->options & PR_O_ABRT_CLOSE)))) {
|
||||||
channel_shutw_now(req);
|
sc_schedule_shutdown(scb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* shutdown(write) pending */
|
/* shutdown(write) pending */
|
||||||
@ -2489,7 +2489,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
|||||||
/* first, let's check if the response buffer needs to shutdown(write) */
|
/* first, let's check if the response buffer needs to shutdown(write) */
|
||||||
if (unlikely((res->flags & CF_AUTO_CLOSE) && (scb->flags & SC_FL_SHUTR) &&
|
if (unlikely((res->flags & CF_AUTO_CLOSE) && (scb->flags & SC_FL_SHUTR) &&
|
||||||
!(scf->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)))) {
|
!(scf->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)))) {
|
||||||
channel_shutw_now(res);
|
sc_schedule_shutdown(scf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* shutdown(write) pending */
|
/* shutdown(write) pending */
|
||||||
@ -2781,7 +2781,7 @@ 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_SHUTW|SC_FL_SHUT_WANTED))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
channel_shutw_now(&stream->req);
|
sc_schedule_shutdown(stream->scb);
|
||||||
sc_schedule_abort(stream->scb);
|
sc_schedule_abort(stream->scb);
|
||||||
stream->task->nice = 1024;
|
stream->task->nice = 1024;
|
||||||
if (!(stream->flags & SF_ERR_MASK))
|
if (!(stream->flags & SF_ERR_MASK))
|
||||||
|
Loading…
Reference in New Issue
Block a user