MEDIUM: log: Use the sedesc to report and detect end of processing

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.
This commit is contained in:
Christopher Faulet 2023-03-31 11:17:13 +02:00
parent 31572229ed
commit 22a88f06d4

View File

@ -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 @@ static void syslog_io_handler(struct appctx *appctx)
missing_budget:
/* it may remain some stuff to do, let's retry later */
appctx_wakeup(appctx);
return;
parse_error:
@ -3677,16 +3679,17 @@ static void syslog_io_handler(struct appctx *appctx)
_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;
}