MINOR: channel: Stop to test CF_READ_ERROR flag if CF_SHUTR is enough

When a read error (CF_READ_ERROR) is reported, a shutdown for reads is
always performed (CF_SHUTR). Thus, there is no reason to check if
CF_READ_ERROR is set if CF_SHUTR is also checked.
This commit is contained in:
Christopher Faulet 2023-01-04 11:55:15 +01:00
parent 2357718217
commit 4b490b7517
5 changed files with 7 additions and 7 deletions

View File

@ -530,7 +530,7 @@ static inline int channel_output_closed(struct channel *chn)
*/ */
static inline void channel_check_timeouts(struct channel *chn) static inline void channel_check_timeouts(struct channel *chn)
{ {
if (likely(!(chn->flags & (CF_SHUTR|CF_READ_TIMEOUT|CF_READ_EVENT|CF_READ_ERROR|CF_READ_NOEXP))) && if (likely(!(chn->flags & (CF_SHUTR|CF_READ_TIMEOUT|CF_READ_EVENT|CF_READ_NOEXP))) &&
unlikely(tick_is_expired(chn->rex, now_ms))) unlikely(tick_is_expired(chn->rex, now_ms)))
chn->flags |= CF_READ_TIMEOUT; chn->flags |= CF_READ_TIMEOUT;

View File

@ -865,7 +865,7 @@ int http_process_tarpit(struct stream *s, struct channel *req, int an_bit)
* there and that the timeout has not expired. * there and that the timeout has not expired.
*/ */
channel_dont_connect(req); channel_dont_connect(req);
if ((req->flags & (CF_SHUTR|CF_READ_ERROR)) == 0 && if (!(req->flags & CF_SHUTR) &&
!tick_is_expired(req->analyse_exp, now_ms)) { !tick_is_expired(req->analyse_exp, now_ms)) {
/* Be sure to drain all data from the request channel */ /* Be sure to drain all data from the request channel */
channel_htx_erase(req, htxbuf(&req->buf)); channel_htx_erase(req, htxbuf(&req->buf));
@ -4244,7 +4244,7 @@ enum rule_result http_wait_for_msg_body(struct stream *s, struct channel *chn,
} }
/* we get here if we need to wait for more data */ /* we get here if we need to wait for more data */
if (!(chn->flags & (CF_SHUTR | CF_READ_ERROR))) { if (!(chn->flags & CF_SHUTR)) {
if (!tick_isset(chn->analyse_exp)) if (!tick_isset(chn->analyse_exp))
chn->analyse_exp = tick_add_ifset(now_ms, time); chn->analyse_exp = tick_add_ifset(now_ms, time);
ret = HTTP_RULE_RES_YIELD; ret = HTTP_RULE_RES_YIELD;

View File

@ -615,7 +615,7 @@ static int smp_fetch_body(const struct arg *args, struct sample *smp, const char
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
if (!finished && (check || (chn && !channel_full(chn, global.tune.maxrewrite) && if (!finished && (check || (chn && !channel_full(chn, global.tune.maxrewrite) &&
!(chn->flags & (CF_EOI|CF_SHUTR|CF_READ_ERROR))))) !(chn->flags & (CF_EOI|CF_SHUTR)))))
smp->flags |= SMP_F_MAY_CHANGE; smp->flags |= SMP_F_MAY_CHANGE;
return 1; return 1;

View File

@ -1781,7 +1781,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
* timeout needs to be refreshed. * timeout needs to be refreshed.
*/ */
if (!((req->flags | res->flags) & if (!((req->flags | res->flags) &
(CF_SHUTR|CF_READ_EVENT|CF_READ_ERROR|CF_READ_TIMEOUT|CF_SHUTW| (CF_SHUTR|CF_READ_EVENT|CF_READ_TIMEOUT|CF_SHUTW|
CF_WRITE_EVENT|CF_WRITE_ERROR|CF_WRITE_TIMEOUT)) && CF_WRITE_EVENT|CF_WRITE_ERROR|CF_WRITE_TIMEOUT)) &&
!(s->flags & SF_CONN_EXP) && !(s->flags & SF_CONN_EXP) &&
!((sc_ep_get(scf) | scb->flags) & SE_FL_ERROR) && !((sc_ep_get(scf) | scb->flags) & SE_FL_ERROR) &&

View File

@ -116,7 +116,7 @@ int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit)
* - if one rule returns KO, then return KO * - if one rule returns KO, then return KO
*/ */
if ((req->flags & (CF_EOI|CF_SHUTR|CF_READ_ERROR)) || channel_full(req, global.tune.maxrewrite) || if ((req->flags & (CF_EOI|CF_SHUTR)) || channel_full(req, global.tune.maxrewrite) ||
sc_waiting_room(chn_prod(req)) || sc_waiting_room(chn_prod(req)) ||
!s->be->tcp_req.inspect_delay || tick_is_expired(s->rules_exp, now_ms)) { !s->be->tcp_req.inspect_delay || tick_is_expired(s->rules_exp, now_ms)) {
partial = SMP_OPT_FINAL; partial = SMP_OPT_FINAL;
@ -299,7 +299,7 @@ int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit)
* - if one rule returns OK, then return OK * - if one rule returns OK, then return OK
* - if one rule returns KO, then return KO * - if one rule returns KO, then return KO
*/ */
if ((rep->flags & (CF_EOI|CF_SHUTR|CF_READ_ERROR)) || channel_full(rep, global.tune.maxrewrite) || if ((rep->flags & (CF_EOI|CF_SHUTR)) || channel_full(rep, global.tune.maxrewrite) ||
sc_waiting_room(chn_prod(rep)) || sc_waiting_room(chn_prod(rep)) ||
!s->be->tcp_rep.inspect_delay || tick_is_expired(s->rules_exp, now_ms)) { !s->be->tcp_rep.inspect_delay || tick_is_expired(s->rules_exp, now_ms)) {
partial = SMP_OPT_FINAL; partial = SMP_OPT_FINAL;