]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: log: Use the sedesc to report and detect end of processing
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 31 Mar 2023 09:17:13 +0000 (11:17 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 5 Apr 2023 06:57:05 +0000 (08:57 +0200)
Just like for other applets, we now use the SE descriptor instead of the
channel to report error and end-of-stream.

Here, the refactoring only reports errors by setting SE_FL_ERROR flag.

src/log.c

index cadab225a3542ed2234a557599f27054f9546c80..6ba601d42cdf9055f6c2776caa4f68158dd6be60 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -3577,6 +3577,9 @@ static void syslog_io_handler(struct appctx *appctx)
        char *message;
        size_t size;
 
+       if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR|SE_FL_SHR|SE_FL_SHW))))
+               goto out;
+
        max_accept = l->bind_conf->maxaccept ? l->bind_conf->maxaccept : 1;
        while (co_data(sc_oc(sc))) {
                char c;
@@ -3669,7 +3672,6 @@ missing_data:
 missing_budget:
        /* it may remain some stuff to do, let's retry later */
        appctx_wakeup(appctx);
-
        return;
 
 parse_error:
@@ -3677,16 +3679,17 @@ parse_error:
                _HA_ATOMIC_INC(&l->counters->failed_req);
        _HA_ATOMIC_INC(&frontend->fe_counters.failed_req);
 
-       goto close;
+       goto error;
 
 cli_abort:
        if (l->counters)
                _HA_ATOMIC_INC(&l->counters->cli_aborts);
        _HA_ATOMIC_INC(&frontend->fe_counters.cli_aborts);
 
-close:
-       sc_shutw(sc);
-       sc_shutr(sc);
+error:
+       se_fl_set(appctx->sedesc, SE_FL_ERROR);
+
+out:
        return;
 }