mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-17 02:56:51 +00:00
MINOR: stconn: Rename SC_FL_SHUTW in SC_FL_SHUT_DONE
Here again, it is just a flag renaming. In SC flags, there is no longer shutdown for writes but shutdowns.
This commit is contained in:
parent
cfc11c0eae
commit
208c712b40
@ -520,7 +520,7 @@ static inline int channel_input_closed(struct channel *chn)
|
||||
/* 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. */
|
||||
@ -977,8 +977,8 @@ static inline int ci_putstr(struct channel *chn, const char *str)
|
||||
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;
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ static inline const char *sc_state_str(int state)
|
||||
__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);
|
||||
@ -376,7 +376,7 @@ static inline int sc_rcv_may_expire(const struct stconn *sc)
|
||||
|
||||
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))
|
||||
|
@ -161,7 +161,7 @@ enum sc_flags {
|
||||
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
|
||||
@ -178,7 +178,7 @@ static forceinline char *sc_show_flags(char *buf, size_t len, const char *delim,
|
||||
_(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;
|
||||
|
@ -625,7 +625,7 @@ static int cli_io_handler_show_profiling(struct appctx *appctx)
|
||||
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);
|
||||
@ -889,7 +889,7 @@ static int cli_io_handler_show_tasks(struct appctx *appctx)
|
||||
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
|
||||
@ -1030,7 +1030,7 @@ static int cli_io_handler_show_activity(struct appctx *appctx)
|
||||
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);
|
||||
|
@ -1956,7 +1956,7 @@ int srv_redispatch_connect(struct stream *s)
|
||||
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))));
|
||||
}
|
||||
|
||||
@ -2246,7 +2246,7 @@ void back_handle_st_con(struct stream *s)
|
||||
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;
|
||||
@ -2470,7 +2470,7 @@ void back_handle_st_rdy(struct stream *s)
|
||||
*/
|
||||
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 */
|
||||
|
@ -206,8 +206,8 @@ int co_getdelim(const struct channel *chn, char *str, int len, const char *delim
|
||||
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;
|
||||
}
|
||||
@ -252,7 +252,7 @@ int co_getdelim(const struct channel *chn, char *str, int len, const char *delim
|
||||
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)
|
||||
@ -279,8 +279,8 @@ int co_getword(const struct channel *chn, char *str, int len, char sep)
|
||||
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;
|
||||
}
|
||||
@ -303,7 +303,7 @@ int co_getword(const struct channel *chn, char *str, int len, char sep)
|
||||
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)
|
||||
@ -330,8 +330,8 @@ int co_getline(const struct channel *chn, char *str, int len)
|
||||
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;
|
||||
}
|
||||
@ -354,7 +354,7 @@ int co_getline(const struct channel *chn, char *str, int len)
|
||||
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)
|
||||
@ -372,11 +372,11 @@ int co_getline(const struct channel *chn, char *str, int len)
|
||||
*/
|
||||
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;
|
||||
}
|
||||
@ -395,11 +395,11 @@ int co_getchar(const struct channel *chn, char *c)
|
||||
*/
|
||||
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;
|
||||
}
|
||||
@ -418,7 +418,7 @@ int co_getblk(const struct channel *chn, char *blk, int len, int offset)
|
||||
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;
|
||||
}
|
||||
@ -460,7 +460,7 @@ int co_getline_nc(const struct channel *chn,
|
||||
}
|
||||
}
|
||||
|
||||
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).
|
||||
@ -536,7 +536,7 @@ int ci_getline_nc(const struct channel *chn,
|
||||
}
|
||||
}
|
||||
|
||||
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).
|
||||
|
10
src/cli.c
10
src/cli.c
@ -1216,7 +1216,7 @@ static int cli_io_handler_show_env(struct appctx *appctx)
|
||||
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);
|
||||
@ -1255,7 +1255,7 @@ static int cli_io_handler_show_fd(struct appctx *appctx)
|
||||
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);
|
||||
@ -2686,7 +2686,7 @@ send_help:
|
||||
|
||||
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;
|
||||
@ -2716,7 +2716,7 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
||||
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;
|
||||
@ -2830,7 +2830,7 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
||||
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);
|
||||
|
@ -314,7 +314,7 @@ static int cli_io_handler_show_threads(struct appctx *appctx)
|
||||
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)
|
||||
@ -1162,7 +1162,7 @@ static int debug_iohandler_fd(struct appctx *appctx)
|
||||
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);
|
||||
@ -1370,7 +1370,7 @@ static int debug_iohandler_memstats(struct appctx *appctx)
|
||||
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) {
|
||||
|
@ -1016,7 +1016,7 @@ flt_xfer_data(struct stream *s, struct channel *chn, unsigned int an_bit)
|
||||
* - 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;
|
||||
}
|
||||
|
@ -983,7 +983,7 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit)
|
||||
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;
|
||||
@ -1023,7 +1023,7 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit)
|
||||
|
||||
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
|
||||
@ -1144,7 +1144,7 @@ static __inline int do_l7_retry(struct stream *s, struct stconn *sc)
|
||||
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;
|
||||
@ -1296,7 +1296,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
||||
/* 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)
|
||||
@ -2104,7 +2104,7 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit
|
||||
|
||||
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;
|
||||
@ -2120,7 +2120,7 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit
|
||||
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
|
||||
@ -2130,7 +2130,7 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit
|
||||
*/
|
||||
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))
|
||||
@ -4272,7 +4272,7 @@ static void http_end_request(struct stream *s)
|
||||
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);
|
||||
}
|
||||
@ -4306,7 +4306,7 @@ static void http_end_request(struct stream *s)
|
||||
|
||||
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;
|
||||
@ -4371,7 +4371,7 @@ static void http_end_response(struct stream *s)
|
||||
/* 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);
|
||||
}
|
||||
@ -4402,7 +4402,7 @@ static void http_end_response(struct stream *s)
|
||||
|
||||
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;
|
||||
|
@ -349,7 +349,7 @@ static int cli_io_handler_pat_list(struct appctx *appctx)
|
||||
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.
|
||||
*/
|
||||
|
@ -568,7 +568,7 @@ static int cli_io_handler_show_proc(struct appctx *appctx)
|
||||
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 */
|
||||
@ -715,7 +715,7 @@ static int cli_io_handler_show_loadstatus(struct appctx *appctx)
|
||||
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");
|
||||
|
@ -3255,7 +3255,7 @@ static int cli_io_handler_show_errors(struct appctx *appctx)
|
||||
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);
|
||||
|
@ -8350,7 +8350,7 @@ static int cli_io_handler_dump_quic(struct appctx *appctx)
|
||||
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.
|
||||
*/
|
||||
|
@ -350,7 +350,7 @@ int cli_io_handler_show_ring(struct appctx *appctx)
|
||||
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);
|
||||
@ -423,7 +423,7 @@ int cli_io_handler_show_ring(struct appctx *appctx)
|
||||
/* 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);
|
||||
|
@ -2149,7 +2149,7 @@ static int cli_io_handler_commit_cert(struct appctx *appctx)
|
||||
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) {
|
||||
@ -2826,7 +2826,7 @@ static int cli_io_handler_commit_cafile_crlfile(struct appctx *appctx)
|
||||
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
|
||||
|
@ -1117,7 +1117,7 @@ static int cli_io_handler_add_crtlist(struct appctx *appctx)
|
||||
* 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) {
|
||||
|
52
src/stconn.c
52
src/stconn.c
@ -544,7 +544,7 @@ static void sc_app_abort(struct stconn *sc)
|
||||
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;
|
||||
@ -570,9 +570,9 @@ static void sc_app_shutw(struct stconn *sc)
|
||||
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);
|
||||
|
||||
@ -630,7 +630,7 @@ static void sc_app_chk_snd(struct stconn *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 */
|
||||
@ -669,7 +669,7 @@ static void sc_app_abort_conn(struct stconn *sc)
|
||||
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)
|
||||
@ -695,9 +695,9 @@ static void sc_app_shutw_conn(struct stconn *sc)
|
||||
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);
|
||||
|
||||
@ -783,7 +783,7 @@ static void sc_app_chk_snd_conn(struct stconn *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 ! */
|
||||
@ -813,13 +813,13 @@ static void sc_app_chk_snd_conn(struct stconn *sc)
|
||||
* 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 {
|
||||
@ -832,7 +832,7 @@ static void sc_app_chk_snd_conn(struct stconn *sc)
|
||||
/* 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) ||
|
||||
@ -867,7 +867,7 @@ static void sc_app_abort_applet(struct stconn *sc)
|
||||
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)
|
||||
@ -892,9 +892,9 @@ static void sc_app_shutw_applet(struct stconn *sc)
|
||||
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);
|
||||
|
||||
@ -952,7 +952,7 @@ static void sc_app_chk_snd_applet(struct stconn *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 */
|
||||
@ -1004,7 +1004,7 @@ void sc_update_tx(struct stconn *sc)
|
||||
{
|
||||
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 */
|
||||
@ -1042,7 +1042,7 @@ static void sc_notify(struct stconn *sc)
|
||||
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);
|
||||
}
|
||||
@ -1050,9 +1050,9 @@ static void sc_notify(struct stconn *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)
|
||||
@ -1115,10 +1115,10 @@ static void sc_notify(struct stconn *sc)
|
||||
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);
|
||||
@ -1148,7 +1148,7 @@ static void sc_conn_read0(struct stconn *sc)
|
||||
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)) {
|
||||
@ -1166,7 +1166,7 @@ static void sc_conn_read0(struct stconn *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)
|
||||
@ -1369,7 +1369,7 @@ static int sc_conn_recv(struct stconn *sc)
|
||||
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)
|
||||
@ -1564,7 +1564,7 @@ static int sc_conn_send(struct stconn *sc)
|
||||
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 */
|
||||
@ -1696,7 +1696,7 @@ void sc_conn_sync_send(struct stconn *sc)
|
||||
|
||||
oc->flags &= ~CF_WRITE_EVENT;
|
||||
|
||||
if (sc->flags & SC_FL_SHUTW)
|
||||
if (sc->flags & SC_FL_SHUT_DONE)
|
||||
return;
|
||||
|
||||
if (channel_is_empty(oc))
|
||||
|
@ -5047,7 +5047,7 @@ static int cli_io_handler_table(struct appctx *appctx)
|
||||
* 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);
|
||||
|
56
src/stream.c
56
src/stream.c
@ -954,7 +954,7 @@ static void back_establish(struct stream *s)
|
||||
}
|
||||
/* 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);
|
||||
}
|
||||
@ -1585,7 +1585,7 @@ static void stream_handle_timeouts(struct stream *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);
|
||||
}
|
||||
@ -1595,7 +1595,7 @@ static void stream_handle_timeouts(struct stream *s)
|
||||
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);
|
||||
}
|
||||
@ -1783,7 +1783,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
* 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) &&
|
||||
@ -1955,8 +1955,8 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
/* 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) {
|
||||
@ -2043,9 +2043,9 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -2060,8 +2060,8 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
|
||||
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) {
|
||||
@ -2116,9 +2116,9 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -2232,7 +2232,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
* 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
|
||||
@ -2284,7 +2284,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
/* 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 :
|
||||
@ -2292,7 +2292,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
* - 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
|
||||
@ -2365,13 +2365,13 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
* 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;
|
||||
@ -2379,7 +2379,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
}
|
||||
|
||||
/* 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);
|
||||
|
||||
@ -2398,7 +2398,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
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 */
|
||||
@ -2447,9 +2447,9 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -2473,7 +2473,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
/* 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);
|
||||
@ -2488,18 +2488,18 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
|
||||
/* 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);
|
||||
|
||||
@ -2520,7 +2520,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
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)
|
||||
@ -2778,7 +2778,7 @@ void default_srv_error(struct stream *s, struct stconn *sc)
|
||||
/* 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);
|
||||
@ -3603,7 +3603,7 @@ static int cli_io_handler_dump_sess(struct appctx *appctx)
|
||||
}
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user