From dcd917d972b79bedd59835418b26b7ec9e3e0207 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 14 Feb 2024 07:56:50 +0100 Subject: [PATCH] MINOR: applet: Remove uselelss test on SE_FL_SHR/SHW flags These both flags are set after releasing the applet, in appctx_shut(). Concretly, it means the applet is shutdown for reads and writes. Once set, the applet's I/O handler was no longer called. Tests on these flags are useless. There is no chance to match them. --- src/cache.c | 3 ++- src/cli.c | 2 +- src/dns.c | 2 +- src/flt_spoe.c | 2 +- src/hlua.c | 2 +- src/http_client.c | 2 +- src/log.c | 2 +- src/peers.c | 2 +- src/sink.c | 3 ++- src/stats.c | 2 +- 10 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/cache.c b/src/cache.c index 0cbc96a78b..2120d877e1 100644 --- a/src/cache.c +++ b/src/cache.c @@ -1788,8 +1788,9 @@ static void http_cache_io_handler(struct appctx *appctx) goto exit; } - if (unlikely(applet_fl_test(appctx, APPCTX_FL_EOS|APPCTX_FL_ERROR|APPCTX_FL_SHUTDOWN))) + if (unlikely(applet_fl_test(appctx, APPCTX_FL_EOS|APPCTX_FL_ERROR))) { goto exit; + } res_htx = htx_from_buf(&appctx->outbuf); diff --git a/src/cli.c b/src/cli.c index f3b015ab0e..f5b5203bb1 100644 --- a/src/cli.c +++ b/src/cli.c @@ -917,7 +917,7 @@ static void cli_io_handler(struct appctx *appctx) int reql; int len; - if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR|SE_FL_SHR|SE_FL_SHW)))) { + if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR)))) { co_skip(sc_oc(sc), co_data(sc_oc(sc))); goto out; } diff --git a/src/dns.c b/src/dns.c index 23e9d9de53..a88aa6eb12 100644 --- a/src/dns.c +++ b/src/dns.c @@ -443,7 +443,7 @@ static void dns_session_io_handler(struct appctx *appctx) size_t len, cnt, ofs; int ret = 0; - if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR|SE_FL_SHR|SE_FL_SHW)))) { + if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR)))) { co_skip(sc_oc(sc), co_data(sc_oc(sc))); goto out; } diff --git a/src/flt_spoe.c b/src/flt_spoe.c index 70ea2bab67..d83eff9bf8 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -1930,7 +1930,7 @@ spoe_handle_appctx(struct appctx *appctx) if (SPOE_APPCTX(appctx) == NULL) return; - if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR|SE_FL_SHR|SE_FL_SHW)))) { + if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR)))) { co_skip(sc_oc(sc), co_data(sc_oc(sc))); goto out; } diff --git a/src/hlua.c b/src/hlua.c index b0abf5fa5a..fb04602b4e 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -2312,7 +2312,7 @@ static void hlua_socket_handler(struct appctx *appctx) struct hlua_csk_ctx *ctx = appctx->svcctx; struct stconn *sc = appctx_sc(appctx); - if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR|SE_FL_SHR|SE_FL_SHW)))) { + if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR)))) { co_skip(sc_oc(sc), co_data(sc_oc(sc))); notification_wake(&ctx->wake_on_read); notification_wake(&ctx->wake_on_write); diff --git a/src/http_client.c b/src/http_client.c index d7e50c016e..4f40475aca 100644 --- a/src/http_client.c +++ b/src/http_client.c @@ -704,7 +704,7 @@ void httpclient_applet_io_handler(struct appctx *appctx) uint32_t sz; int ret; - if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR|SE_FL_SHR|SE_FL_SHW)))) { + if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR)))) { if (co_data(res)) { htx = htx_from_buf(&res->buf); co_htx_skip(res, htx, co_data(res)); diff --git a/src/log.c b/src/log.c index a71f206060..5e704cddb1 100644 --- a/src/log.c +++ b/src/log.c @@ -4220,7 +4220,7 @@ 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)))) { + if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR)))) { co_skip(sc_oc(sc), co_data(sc_oc(sc))); goto out; } diff --git a/src/peers.c b/src/peers.c index 5ed0e3f68e..ddb9f2f7df 100644 --- a/src/peers.c +++ b/src/peers.c @@ -3025,7 +3025,7 @@ static void peer_io_handler(struct appctx *appctx) unsigned int maj_ver, min_ver; int prev_state; - if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR|SE_FL_SHR|SE_FL_SHW)))) { + if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR)))) { co_skip(sc_oc(sc), co_data(sc_oc(sc))); goto out; } diff --git a/src/sink.c b/src/sink.c index 66c2b8c77f..a5cd60657a 100644 --- a/src/sink.c +++ b/src/sink.c @@ -312,8 +312,9 @@ static void sink_forward_io_handler(struct appctx *appctx) size_t len, cnt, ofs, last_ofs; int ret = 0; - if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR|SE_FL_SHR|SE_FL_SHW)))) + if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR)))) { goto out; + } /* if stopping was requested, close immediately */ if (unlikely(stopping)) diff --git a/src/stats.c b/src/stats.c index 50943b9906..1c2f750420 100644 --- a/src/stats.c +++ b/src/stats.c @@ -4509,7 +4509,7 @@ static void http_stats_io_handler(struct appctx *appctx) res_htx = htx_from_buf(&appctx->outbuf); - if (unlikely(applet_fl_test(appctx, APPCTX_FL_EOS|APPCTX_FL_ERROR|APPCTX_FL_SHUTDOWN))) { + if (unlikely(applet_fl_test(appctx, APPCTX_FL_EOS|APPCTX_FL_ERROR))) { appctx->st0 = STAT_HTTP_END; goto out; } -- 2.39.5