MEDIUM: stream: Stop to use SE flags to detect read errors from analyzers
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 14 Apr 2023 10:05:55 +0000 (12:05 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 14 Apr 2023 15:05:54 +0000 (17:05 +0200)
In the same way the previous commit, we stop to use SE_FL_ERROR flag from
analyzers and their sub-functions. We now fully rely on SC_FL_ERROR to do so.

src/cli.c
src/http_ana.c
src/tcp_rules.c

index 14b92a5..fb8f687 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -2715,7 +2715,7 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
        struct proxy *fe = strm_fe(s);
        struct proxy *be = s->be;
 
-       if ((s->scb->flags & SC_FL_ERROR) || sc_ep_test(s->scb, SE_FL_ERROR) || (rep->flags & (CF_READ_TIMEOUT|CF_WRITE_TIMEOUT)) ||
+       if ((s->scb->flags & SC_FL_ERROR) || (rep->flags & (CF_READ_TIMEOUT|CF_WRITE_TIMEOUT)) ||
            ((s->scf->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;
index 087cfe1..8828e6b 100644 (file)
@@ -784,7 +784,7 @@ int http_process_tarpit(struct stream *s, struct channel *req, int an_bit)
         */
        s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);
 
-       http_reply_and_close(s, txn->status, (!(s->scf->flags & SC_FL_ERROR) && !sc_ep_test(s->scf, SE_FL_ERROR) ? http_error_message(s) : NULL));
+       http_reply_and_close(s, txn->status, (!(s->scf->flags & SC_FL_ERROR) ? http_error_message(s) : NULL));
        http_set_term_flags(s);
 
        DBG_TRACE_LEAVE(STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn);
@@ -1215,7 +1215,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
   next_one:
        if (unlikely(htx_is_empty(htx) || htx->first == -1)) {
                /* 1: have we encountered a read error ? */
-               if ((s->scb->flags & SC_FL_ERROR) || sc_ep_test(s->scb, SE_FL_ERROR)) {
+               if (s->scb->flags & SC_FL_ERROR) {
                        struct connection *conn = sc_conn(s->scb);
 
 
@@ -2672,7 +2672,7 @@ static enum rule_result http_req_get_intercept_rule(struct proxy *px, struct lis
 
                /* Always call the action function if defined */
                if (rule->action_ptr) {
-                       if ((s->scf->flags & SC_FL_ERROR) || sc_ep_test(s->scf, SE_FL_ERROR) ||
+                       if ((s->scf->flags & SC_FL_ERROR) ||
                            ((s->scf->flags & SC_FL_ABRT_DONE) &&
                             (px->options & PR_O_ABRT_CLOSE)))
                                act_opts |= ACT_OPT_FINAL;
@@ -2835,7 +2835,7 @@ resume_execution:
 
                /* Always call the action function if defined */
                if (rule->action_ptr) {
-                       if ((s->scf->flags & SC_FL_ERROR) || sc_ep_test(s->scf, SE_FL_ERROR) ||
+                       if ((s->scf->flags & SC_FL_ERROR) ||
                            ((s->scf->flags & SC_FL_ABRT_DONE) &&
                             (px->options & PR_O_ABRT_CLOSE)))
                                act_opts |= ACT_OPT_FINAL;
index 991c16d..e9eb268 100644 (file)
@@ -121,7 +121,7 @@ int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit)
            !s->be->tcp_req.inspect_delay || tick_is_expired(s->rules_exp, now_ms)) {
                partial = SMP_OPT_FINAL;
                /* Action may yield while the inspect_delay is not expired and there is no read error */
-               if ((s->scf->flags & SC_FL_ERROR) || sc_ep_test(s->scf, SE_FL_ERROR) || !s->be->tcp_req.inspect_delay || tick_is_expired(s->rules_exp, now_ms))
+               if ((s->scf->flags & SC_FL_ERROR) || !s->be->tcp_req.inspect_delay || tick_is_expired(s->rules_exp, now_ms))
                        act_opts |= ACT_OPT_FINAL;
        }
        else
@@ -303,7 +303,7 @@ int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit)
            !s->be->tcp_rep.inspect_delay || tick_is_expired(s->rules_exp, now_ms)) {
                partial = SMP_OPT_FINAL;
                /* Action may yield while the inspect_delay is not expired and there is no read error */
-               if ((s->scb->flags & SC_FL_ERROR) || sc_ep_test(s->scb, SE_FL_ERROR) || !s->be->tcp_rep.inspect_delay || tick_is_expired(s->rules_exp, now_ms))
+               if ((s->scb->flags & SC_FL_ERROR) || !s->be->tcp_rep.inspect_delay || tick_is_expired(s->rules_exp, now_ms))
                        act_opts |= ACT_OPT_FINAL;
        }
        else