mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-05-04 20:46:11 +02:00
MINOR: stconn: Rename SC_FL_SHUTW_NOW in SC_FL_SHUT_WANTED
Because shutowns for reads are now considered as aborts, the shudowns for writes can now be considered as shutdowns. Here it is just a flag renaming. SC_FL_SHUTW_NOW is renamed SC_FL_SHUT_WANTED.
This commit is contained in:
parent
12762f09a5
commit
e38534cbd0
@ -551,14 +551,14 @@ static inline void channel_htx_erase(struct channel *chn, struct htx *htx)
|
||||
/* marks the channel as "shutdown" ASAP for writes */
|
||||
static inline void channel_shutw_now(struct channel *chn)
|
||||
{
|
||||
chn_cons(chn)->flags |= SC_FL_SHUTW_NOW;
|
||||
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)
|
||||
{
|
||||
chn_prod(chn)->flags |= SC_FL_ABRT_WANTED;
|
||||
chn_cons(chn)->flags |= SC_FL_SHUTW_NOW;
|
||||
chn_cons(chn)->flags |= SC_FL_SHUT_WANTED;
|
||||
chn->flags |= CF_AUTO_CLOSE;
|
||||
chn->flags &= ~CF_AUTO_CONNECT;
|
||||
}
|
||||
@ -983,7 +983,7 @@ 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_SHUTW_NOW))
|
||||
if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))
|
||||
return -2;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ enum sc_flags {
|
||||
SC_FL_SND_EXP_MORE = 0x00001000, /* More data expected to be sent very soon. cleared when all data were sent */
|
||||
|
||||
SC_FL_ABRT_WANTED = 0x00002000, /* An abort was requested and must be performed ASAP */
|
||||
SC_FL_SHUTW_NOW = 0x00004000, /* SC must shut down for reads ASAP */
|
||||
SC_FL_SHUT_WANTED = 0x00004000, /* A shutdown was requested and mux be performed ASAP */
|
||||
SC_FL_SHUTR = 0x00008000, /* SC is shut down for writes */
|
||||
SC_FL_SHUTW = 0x00010000, /* SC must shut down for writes ASAP */
|
||||
};
|
||||
@ -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_SHUTW_NOW, _(SC_FL_SHUTR, _(SC_FL_SHUTW)))))))))))))))));
|
||||
_(SC_FL_ABRT_WANTED, _(SC_FL_SHUT_WANTED, _(SC_FL_SHUTR, _(SC_FL_SHUTW)))))))))))))))));
|
||||
/* epilogue */
|
||||
_(~0U);
|
||||
return buf;
|
||||
|
||||
@ -471,7 +471,7 @@ struct task *task_run_applet(struct task *t, void *context, unsigned int state)
|
||||
(b_size(sc_ib(sc)) && !b_data(sc_ib(sc)) && sc->flags & SC_FL_NEED_ROOM) || // asks for room in an empty buffer
|
||||
(b_data(sc_ob(sc)) && sc_is_send_allowed(sc)) || // asks for data already present
|
||||
(!b_data(sc_ib(sc)) && b_data(sc_ob(sc)) && // didn't return anything ...
|
||||
(!(sc_oc(sc)->flags & CF_WRITE_EVENT) && (sc->flags & SC_FL_SHUTW_NOW))))) { // ... and left data pending after a shut
|
||||
(!(sc_oc(sc)->flags & CF_WRITE_EVENT) && (sc->flags & SC_FL_SHUT_WANTED))))) { // ... and left data pending after a shut
|
||||
rate = update_freq_ctr(&app->call_rate, 1);
|
||||
if (rate >= 100000 && app->call_rate.prev_ctr) // looped like this more than 100k times over last second
|
||||
stream_dump_and_crash(&app->obj_type, read_freq_ctr(&app->call_rate));
|
||||
|
||||
@ -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_SHUTW_NOW|SC_FL_SHUTW)) && /* empty and client aborted */
|
||||
((chn_cons(req)->flags & (SC_FL_SHUT_WANTED|SC_FL_SHUTW)) && /* empty and client aborted */
|
||||
(channel_is_empty(req) || (s->be->options & PR_O_ABRT_CLOSE))));
|
||||
}
|
||||
|
||||
@ -2247,7 +2247,7 @@ void back_handle_st_con(struct stream *s)
|
||||
|
||||
/* the client might want to abort */
|
||||
if ((chn_cons(rep)->flags & SC_FL_SHUTW) ||
|
||||
((chn_cons(req)->flags & SC_FL_SHUTW_NOW) &&
|
||||
((chn_cons(req)->flags & SC_FL_SHUT_WANTED) &&
|
||||
(channel_is_empty(req) || (s->be->options & PR_O_ABRT_CLOSE)))) {
|
||||
sc->flags |= SC_FL_NOLINGER;
|
||||
sc_shutw(sc);
|
||||
@ -2471,7 +2471,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) ||
|
||||
((chn_cons(req)->flags & SC_FL_SHUTW_NOW) &&
|
||||
((chn_cons(req)->flags & SC_FL_SHUT_WANTED) &&
|
||||
(channel_is_empty(req) || (s->be->options & PR_O_ABRT_CLOSE)))) {
|
||||
/* give up */
|
||||
sc->flags |= SC_FL_NOLINGER;
|
||||
|
||||
@ -207,7 +207,7 @@ int co_getdelim(const struct channel *chn, char *str, int len, const char *delim
|
||||
|
||||
/* 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_SHUTW_NOW))
|
||||
if (chn_cons(chn)->flags & (SC_FL_SHUTW|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_SHUTW_NOW)))
|
||||
!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)))
|
||||
ret = 0;
|
||||
out:
|
||||
if (max)
|
||||
@ -280,7 +280,7 @@ int co_getword(const struct channel *chn, char *str, int len, char sep)
|
||||
|
||||
/* 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_SHUTW_NOW))
|
||||
if (chn_cons(chn)->flags & (SC_FL_SHUTW|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_SHUTW_NOW)))
|
||||
!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)))
|
||||
ret = 0;
|
||||
out:
|
||||
if (max)
|
||||
@ -331,7 +331,7 @@ int co_getline(const struct channel *chn, char *str, int 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_SHUTW_NOW))
|
||||
if (chn_cons(chn)->flags & (SC_FL_SHUTW|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_SHUTW_NOW)))
|
||||
!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)))
|
||||
ret = 0;
|
||||
out:
|
||||
if (max)
|
||||
@ -376,7 +376,7 @@ int co_getchar(const struct channel *chn, char *c)
|
||||
return -1;
|
||||
|
||||
if (unlikely(co_data(chn) == 0)) {
|
||||
if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW))
|
||||
if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
@ -399,7 +399,7 @@ int co_getblk(const struct channel *chn, char *blk, int len, int offset)
|
||||
return -1;
|
||||
|
||||
if (len + offset > co_data(chn) || co_data(chn) == 0) {
|
||||
if (chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW))
|
||||
if (chn_cons(chn)->flags & (SC_FL_SHUTW|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_SHUTW_NOW))
|
||||
if (chn_cons(chn)->flags & (SC_FL_SHUTW|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_SHUTW_NOW)) {
|
||||
if (chn_cons(chn)->flags & (SC_FL_SHUTW|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).
|
||||
|
||||
@ -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_SHUTW_NOW);
|
||||
s->scb->flags &= ~(SC_FL_SHUTW|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);
|
||||
|
||||
@ -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_SHUTW_NOW);
|
||||
s->scb->flags &= ~(SC_FL_SHUTW|SC_FL_SHUT_WANTED);
|
||||
if (sc_reset_endp(s->scb) < 0) {
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_INTERNAL;
|
||||
@ -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_SHUTW_NOW))) {
|
||||
if (!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))) {
|
||||
sc_schedule_abort(s->scf);
|
||||
channel_shutw_now(chn);
|
||||
}
|
||||
@ -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_SHUTW_NOW)) {
|
||||
if (chn_cons(chn)->flags & (SC_FL_SHUTW|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_SHUTW_NOW))) {
|
||||
if (!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))) {
|
||||
sc_schedule_abort(s->scb);
|
||||
channel_shutw_now(chn);
|
||||
}
|
||||
@ -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_SHUTW_NOW)) {
|
||||
if (chn_cons(chn)->flags & (SC_FL_SHUTW|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;
|
||||
|
||||
30
src/stconn.c
30
src/stconn.c
@ -501,7 +501,7 @@ struct appctx *sc_applet_create(struct stconn *sc, struct applet *app)
|
||||
|
||||
/* Conditionally forward the close to the write side. It return 1 if it can be
|
||||
* forwarded. It is the caller responsibility to forward the close to the write
|
||||
* side. Otherwise, 0 is returned. In this case, SC_FL_SHUTW_NOW flag may be set on
|
||||
* side. Otherwise, 0 is returned. In this case, SC_FL_SHUT_WANTED flag may be set on
|
||||
* the consumer SC if we are only waiting for the outgoing data to be flushed.
|
||||
*/
|
||||
static inline int sc_cond_forward_shutw(struct stconn *sc)
|
||||
@ -569,7 +569,7 @@ static void sc_app_shutw(struct stconn *sc)
|
||||
struct channel *ic = sc_ic(sc);
|
||||
struct channel *oc = sc_oc(sc);
|
||||
|
||||
sc->flags &= ~SC_FL_SHUTW_NOW;
|
||||
sc->flags &= ~SC_FL_SHUT_WANTED;
|
||||
if (sc->flags & SC_FL_SHUTW)
|
||||
return;
|
||||
sc->flags |= SC_FL_SHUTW;
|
||||
@ -694,7 +694,7 @@ static void sc_app_shutw_conn(struct stconn *sc)
|
||||
|
||||
BUG_ON(!sc_conn(sc));
|
||||
|
||||
sc->flags &= ~SC_FL_SHUTW_NOW;
|
||||
sc->flags &= ~SC_FL_SHUT_WANTED;
|
||||
if (sc->flags & SC_FL_SHUTW)
|
||||
return;
|
||||
sc->flags |= SC_FL_SHUTW;
|
||||
@ -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_SHUTW_NOW)) == SC_FL_SHUTW_NOW) &&
|
||||
((sc->flags & (SC_FL_SHUTW|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_SHUTW_NOW)) == 0)
|
||||
if ((sc->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) == 0)
|
||||
sc_ep_set(sc, SE_FL_WAIT_DATA);
|
||||
}
|
||||
else {
|
||||
@ -891,7 +891,7 @@ static void sc_app_shutw_applet(struct stconn *sc)
|
||||
|
||||
BUG_ON(!sc_appctx(sc));
|
||||
|
||||
sc->flags &= ~SC_FL_SHUTW_NOW;
|
||||
sc->flags &= ~SC_FL_SHUT_WANTED;
|
||||
if (sc->flags & SC_FL_SHUTW)
|
||||
return;
|
||||
sc->flags |= SC_FL_SHUTW;
|
||||
@ -1011,7 +1011,7 @@ void sc_update_tx(struct stconn *sc)
|
||||
if (channel_is_empty(oc)) {
|
||||
/* stop writing */
|
||||
if (!sc_ep_test(sc, SE_FL_WAIT_DATA)) {
|
||||
if ((sc->flags & SC_FL_SHUTW_NOW) == 0)
|
||||
if ((sc->flags & SC_FL_SHUT_WANTED) == 0)
|
||||
sc_ep_set(sc, SE_FL_WAIT_DATA);
|
||||
}
|
||||
return;
|
||||
@ -1042,17 +1042,17 @@ 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_SHUTW_NOW)) == SC_FL_SHUTW_NOW) &&
|
||||
if (((sc->flags & (SC_FL_SHUTW|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_SHUTW_NOW is there.
|
||||
* 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_SHUTW_NOW)))
|
||||
if (!(sc->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)))
|
||||
sc_ep_set(sc, SE_FL_WAIT_DATA);
|
||||
else if ((sc->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW)) == SC_FL_SHUTW_NOW)
|
||||
else if ((sc->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED)
|
||||
sc_ep_clr(sc, SE_FL_WAIT_DATA);
|
||||
|
||||
if (oc->flags & CF_DONT_READ)
|
||||
@ -1118,7 +1118,7 @@ static void sc_notify(struct stconn *sc)
|
||||
(sc->flags & SC_FL_SHUTW) ||
|
||||
(((oc->flags & CF_WAKE_WRITE) ||
|
||||
(!(oc->flags & CF_AUTO_CLOSE) &&
|
||||
!(sc->flags & (SC_FL_SHUTW_NOW|SC_FL_SHUTW)))) &&
|
||||
!(sc->flags & (SC_FL_SHUT_WANTED|SC_FL_SHUTW)))) &&
|
||||
(sco->state != SC_ST_EST ||
|
||||
(channel_is_empty(oc) && !oc->to_forward)))))) {
|
||||
task_wakeup(task, TASK_WOKEN_IO);
|
||||
@ -1165,7 +1165,7 @@ static void sc_conn_read0(struct stconn *sc)
|
||||
/* OK we completely close the socket here just as if we went through sc_shut[rw]() */
|
||||
sc_conn_shut(sc);
|
||||
|
||||
sc->flags &= ~SC_FL_SHUTW_NOW;
|
||||
sc->flags &= ~SC_FL_SHUT_WANTED;
|
||||
sc->flags |= SC_FL_SHUTW;
|
||||
|
||||
sc->state = SC_ST_DIS;
|
||||
@ -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_SHUTW_NOW))) {
|
||||
if (ic->to_forward && !(chn_cons(ic)->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))) {
|
||||
unsigned long fwd = ret;
|
||||
if (ic->to_forward != CHN_INFINITE_FORWARD) {
|
||||
if (fwd > ic->to_forward)
|
||||
@ -1612,7 +1612,7 @@ static int sc_conn_send(struct stconn *sc)
|
||||
(!(sco->flags & (SC_FL_EOI|SC_FL_SHUTR)) && htx_expect_more(htxbuf(&oc->buf)))))) ||
|
||||
((oc->flags & CF_ISRESP) &&
|
||||
(oc->flags & CF_AUTO_CLOSE) &&
|
||||
(sc->flags & SC_FL_SHUTW_NOW)))
|
||||
(sc->flags & SC_FL_SHUT_WANTED)))
|
||||
send_flag |= CO_SFL_MSG_MORE;
|
||||
|
||||
if (oc->flags & CF_STREAMER)
|
||||
|
||||
34
src/stream.c
34
src/stream.c
@ -1955,7 +1955,7 @@ 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_SHUTR|SC_FL_ABRT_WANTED)) ||
|
||||
((scb->flags ^ scb_flags) & (SC_FL_SHUTW|SC_FL_SHUTW_NOW)) ||
|
||||
((scb->flags ^ scb_flags) & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) ||
|
||||
(req->analysers && (chn_cons(req)->flags & SC_FL_SHUTW)) ||
|
||||
scf->state != rq_prod_last ||
|
||||
scb->state != rq_cons_last ||
|
||||
@ -2043,7 +2043,7 @@ 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_SHUTR|SC_FL_ABRT_WANTED)) | (scf->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED));
|
||||
scb_flags = (scb_flags & ~(SC_FL_SHUTW|SC_FL_SHUTW_NOW)) | (scb->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW));
|
||||
scb_flags = (scb_flags & ~(SC_FL_SHUTW|SC_FL_SHUT_WANTED)) | (scb->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED));
|
||||
|
||||
if (((scf->flags ^ scf_flags_ana) & SC_FL_SHUTR) || ((scb->flags ^ scb_flags_ana) & SC_FL_SHUTW))
|
||||
goto resync_request;
|
||||
@ -2060,7 +2060,7 @@ 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_SHUTR|SC_FL_ABRT_WANTED)) ||
|
||||
((scf->flags ^ scf_flags) & (SC_FL_SHUTW|SC_FL_SHUTW_NOW)) ||
|
||||
((scf->flags ^ scf_flags) & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) ||
|
||||
(res->analysers && (chn_cons(res)->flags & SC_FL_SHUTW)) ||
|
||||
scf->state != rp_cons_last ||
|
||||
scb->state != rp_prod_last ||
|
||||
@ -2116,7 +2116,7 @@ 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_SHUTR|SC_FL_ABRT_WANTED)) | (scb->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED));
|
||||
scf_flags = (scf_flags & ~(SC_FL_SHUTW|SC_FL_SHUTW_NOW)) | (scf->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW));
|
||||
scf_flags = (scf_flags & ~(SC_FL_SHUTW|SC_FL_SHUT_WANTED)) | (scf->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED));
|
||||
|
||||
if (((scb->flags ^ scb_flags_ana) & SC_FL_SHUTR) || ((scf->flags ^ scf_flags_ana) & SC_FL_SHUTW))
|
||||
goto resync_response;
|
||||
@ -2251,7 +2251,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
*/
|
||||
co_set_data(req, htx->data);
|
||||
if ((global.tune.options & GTUNE_USE_FAST_FWD) &&
|
||||
!(scf->flags & SC_FL_SHUTR) && !(scb->flags & SC_FL_SHUTW_NOW))
|
||||
!(scf->flags & SC_FL_SHUTR) && !(scb->flags & SC_FL_SHUT_WANTED))
|
||||
channel_htx_forward_forever(req, htx);
|
||||
}
|
||||
else {
|
||||
@ -2260,7 +2260,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
*/
|
||||
c_adv(req, ci_data(req));
|
||||
if ((global.tune.options & GTUNE_USE_FAST_FWD) &&
|
||||
!(scf->flags & SC_FL_SHUTR) && !(scb->flags & SC_FL_SHUTW_NOW))
|
||||
!(scf->flags & SC_FL_SHUTR) && !(scb->flags & SC_FL_SHUT_WANTED))
|
||||
channel_forward_forever(req);
|
||||
}
|
||||
}
|
||||
@ -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_SHUTR|SC_FL_ABRT_WANTED)) | (scf->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED));
|
||||
scb_flags = (scb_flags & ~(SC_FL_SHUTW|SC_FL_SHUTW_NOW)) | (scb->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW));
|
||||
scb_flags = (scb_flags & ~(SC_FL_SHUTW|SC_FL_SHUT_WANTED)) | (scb->flags & (SC_FL_SHUTW|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 :
|
||||
@ -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_SHUTR) &&
|
||||
!(scb->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW)) &&
|
||||
!(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);
|
||||
}
|
||||
|
||||
/* shutdown(write) pending */
|
||||
if (unlikely((scb->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW)) == SC_FL_SHUTW_NOW &&
|
||||
if (unlikely((scb->flags & (SC_FL_SHUTW|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;
|
||||
@ -2409,7 +2409,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
* recent call to channel_abort().
|
||||
*/
|
||||
if (unlikely((!res->analysers || (res->analysers == AN_RES_FLT_END && !(res->flags & CF_FLT_ANALYZE))) &&
|
||||
!(scf->flags & SC_FL_ABRT_WANTED) && !(scb->flags & SC_FL_SHUTW_NOW) &&
|
||||
!(scf->flags & SC_FL_ABRT_WANTED) && !(scb->flags & SC_FL_SHUT_WANTED) &&
|
||||
sc_state_in(scb->state, SC_SB_EST|SC_SB_DIS|SC_SB_CLO) &&
|
||||
(res->to_forward != CHN_INFINITE_FORWARD))) {
|
||||
/* This buffer is freewheeling, there's no analyser
|
||||
@ -2427,7 +2427,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
*/
|
||||
co_set_data(res, htx->data);
|
||||
if ((global.tune.options & GTUNE_USE_FAST_FWD) &&
|
||||
!(scf->flags & SC_FL_SHUTR) && !(scb->flags & SC_FL_SHUTW_NOW))
|
||||
!(scf->flags & SC_FL_SHUTR) && !(scb->flags & SC_FL_SHUT_WANTED))
|
||||
channel_htx_forward_forever(res, htx);
|
||||
}
|
||||
else {
|
||||
@ -2436,7 +2436,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
*/
|
||||
c_adv(res, ci_data(res));
|
||||
if ((global.tune.options & GTUNE_USE_FAST_FWD) &&
|
||||
!(scf->flags & SC_FL_SHUTR) && !(scb->flags & SC_FL_SHUTW_NOW))
|
||||
!(scf->flags & SC_FL_SHUTR) && !(scb->flags & SC_FL_SHUT_WANTED))
|
||||
channel_forward_forever(res);
|
||||
}
|
||||
|
||||
@ -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_SHUTR|SC_FL_ABRT_WANTED)) | (scb->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED));
|
||||
scf_flags = (scf_flags & ~(SC_FL_SHUTW|SC_FL_SHUTW_NOW)) | (scf->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW));
|
||||
scf_flags = (scf_flags & ~(SC_FL_SHUTW|SC_FL_SHUT_WANTED)) | (scf->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED));
|
||||
|
||||
/* Let's see if we can send the pending response now */
|
||||
sc_conn_sync_send(scf);
|
||||
@ -2488,12 +2488,12 @@ 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_SHUTR) &&
|
||||
!(scf->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW)))) {
|
||||
!(scf->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)))) {
|
||||
channel_shutw_now(res);
|
||||
}
|
||||
|
||||
/* shutdown(write) pending */
|
||||
if (unlikely((scf->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW)) == SC_FL_SHUTW_NOW &&
|
||||
if (unlikely((scf->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED &&
|
||||
channel_is_empty(res))) {
|
||||
sc_shutw(scf);
|
||||
}
|
||||
@ -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_SHUTR|SC_FL_ABRT_WANTED)) ||
|
||||
((scf->flags ^ scf_flags) & (SC_FL_SHUTW|SC_FL_SHUTW_NOW)))
|
||||
((scf->flags ^ scf_flags) & (SC_FL_SHUTW|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_SHUTW_NOW))
|
||||
if (stream->scb->flags & (SC_FL_SHUTW|SC_FL_SHUT_WANTED))
|
||||
return;
|
||||
|
||||
channel_shutw_now(&stream->req);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user