From: Christopher Faulet Date: Mon, 12 Dec 2022 07:08:15 +0000 (+0100) Subject: REORG: channel: Rename CF_READ_NULL to CF_READ_EVENT X-Git-Tag: v2.8-dev2~79 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6e1bbc446b74744129ec3dabd70b2b37eacf7bee;p=thirdparty%2Fhaproxy.git REORG: channel: Rename CF_READ_NULL to CF_READ_EVENT CF_READ_NULL flag is not really useful and used. It is a transient event used to wakeup the stream. As we will see, all read events on a channel may be resumed to only one and are all used to wake up the stream. In this patch, we introduce CF_READ_EVENT flag as a replacement to CF_READ_NULL. There is no breaking change for now, it is just a rename. Gradually, other read events will be merged with this one. --- diff --git a/addons/promex/service-prometheus.c b/addons/promex/service-prometheus.c index 5622b80390..4fee8c353f 100644 --- a/addons/promex/service-prometheus.c +++ b/addons/promex/service-prometheus.c @@ -1598,7 +1598,7 @@ static void promex_appctx_handle_io(struct appctx *appctx) case PROMEX_ST_END: if (!(res->flags & CF_SHUTR)) { - res->flags |= CF_READ_NULL; + res->flags |= CF_READ_EVENT; sc_shutr(sc); } } @@ -1614,7 +1614,7 @@ static void promex_appctx_handle_io(struct appctx *appctx) return; error: - res->flags |= CF_READ_NULL; + res->flags |= CF_READ_EVENT; sc_shutr(sc); sc_shutw(sc); } diff --git a/include/haproxy/channel-t.h b/include/haproxy/channel-t.h index 5cfd54f615..ff764a7a6e 100644 --- a/include/haproxy/channel-t.h +++ b/include/haproxy/channel-t.h @@ -53,11 +53,11 @@ * Please also update the chn_show_flags() function below in case of changes. */ -#define CF_READ_NULL 0x00000001 /* last read detected on producer side */ +#define CF_READ_EVENT 0x00000001 /* a read event detected on producer side */ #define CF_READ_PARTIAL 0x00000002 /* some data were read from producer or a read exception occurred */ #define CF_READ_TIMEOUT 0x00000004 /* timeout while waiting for producer */ #define CF_READ_ERROR 0x00000008 /* unrecoverable error on producer side */ -#define CF_READ_ACTIVITY (CF_READ_NULL|CF_READ_PARTIAL|CF_READ_ERROR) +#define CF_READ_ACTIVITY (CF_READ_EVENT|CF_READ_PARTIAL|CF_READ_ERROR) /* unused: 0x00000010 */ #define CF_SHUTR 0x00000020 /* producer has already shut down */ @@ -138,7 +138,7 @@ static forceinline char *chn_show_flags(char *buf, size_t len, const char *delim /* prologue */ _(0); /* flags */ - _(CF_READ_NULL, _(CF_READ_PARTIAL, _(CF_READ_TIMEOUT, _(CF_READ_ERROR, + _(CF_READ_EVENT, _(CF_READ_PARTIAL, _(CF_READ_TIMEOUT, _(CF_READ_ERROR, _(CF_SHUTR, _(CF_SHUTR_NOW, _(CF_READ_NOEXP, _(CF_WRITE_NULL, _(CF_WRITE_PARTIAL, _(CF_WRITE_TIMEOUT, _(CF_WRITE_ERROR, _(CF_WAKE_WRITE, _(CF_SHUTW, _(CF_SHUTW_NOW, _(CF_AUTO_CLOSE, diff --git a/src/cache.c b/src/cache.c index 604d98d20f..fc800b799a 100644 --- a/src/cache.c +++ b/src/cache.c @@ -1533,7 +1533,7 @@ static void http_cache_io_handler(struct appctx *appctx) end: if (!(res->flags & CF_SHUTR) && appctx->st0 == HTX_CACHE_END) { - res->flags |= CF_READ_NULL; + res->flags |= CF_READ_EVENT; sc_shutr(sc); } diff --git a/src/cli.c b/src/cli.c index 79e7e5d4dd..0d78e2de5b 100644 --- a/src/cli.c +++ b/src/cli.c @@ -1184,7 +1184,7 @@ static void cli_io_handler(struct appctx *appctx) * on the response buffer. */ sc_shutr(sc); - res->flags |= CF_READ_NULL; + res->flags |= CF_READ_EVENT; } out: @@ -2785,7 +2785,7 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit) sc_set_state(s->scb, SC_ST_INI); s->scb->flags &= SC_FL_ISBACK | SC_FL_DONT_WAKE; /* we're in the context of process_stream */ s->req.flags &= ~(CF_SHUTW|CF_SHUTW_NOW|CF_AUTO_CONNECT|CF_WRITE_ERROR|CF_STREAMER|CF_STREAMER_FAST|CF_NEVER_WAIT|CF_WROTE_DATA); - s->res.flags &= ~(CF_SHUTR|CF_SHUTR_NOW|CF_READ_ATTACHED|CF_READ_ERROR|CF_READ_NOEXP|CF_STREAMER|CF_STREAMER_FAST|CF_WRITE_PARTIAL|CF_NEVER_WAIT|CF_WROTE_DATA|CF_READ_NULL); + s->res.flags &= ~(CF_SHUTR|CF_SHUTR_NOW|CF_READ_ATTACHED|CF_READ_ERROR|CF_READ_NOEXP|CF_STREAMER|CF_STREAMER_FAST|CF_WRITE_PARTIAL|CF_NEVER_WAIT|CF_WROTE_DATA|CF_READ_EVENT); s->flags &= ~(SF_DIRECT|SF_ASSIGNED|SF_BE_ASSIGNED|SF_FORCE_PRST|SF_IGNORE_PRST); s->flags &= ~(SF_CURR_SESS|SF_REDIRECTABLE|SF_SRV_REUSED); s->flags &= ~(SF_ERR_MASK|SF_FINST_MASK|SF_REDISP); diff --git a/src/dns.c b/src/dns.c index ee0353d10a..a6e6af8bbd 100644 --- a/src/dns.c +++ b/src/dns.c @@ -766,7 +766,7 @@ read: close: sc_shutw(sc); sc_shutr(sc); - sc_ic(sc)->flags |= CF_READ_NULL; + sc_ic(sc)->flags |= CF_READ_EVENT; } void dns_queries_flush(struct dns_session *ds) diff --git a/src/flt_spoe.c b/src/flt_spoe.c index ed31943816..3e4fe9735d 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -1303,7 +1303,7 @@ spoe_release_appctx(struct appctx *appctx) sc_shutw(sc); sc_shutr(sc); - sc_ic(sc)->flags |= CF_READ_NULL; + sc_ic(sc)->flags |= CF_READ_EVENT; } /* Destroy the task attached to this applet */ @@ -2022,7 +2022,7 @@ spoe_handle_appctx(struct appctx *appctx) sc_shutw(sc); sc_shutr(sc); - sc_ic(sc)->flags |= CF_READ_NULL; + sc_ic(sc)->flags |= CF_READ_EVENT; __fallthrough; case SPOE_APPCTX_ST_END: diff --git a/src/hlua.c b/src/hlua.c index a037991479..722fb88d0a 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -1989,7 +1989,7 @@ static void hlua_socket_handler(struct appctx *appctx) if (ctx->die) { sc_shutw(sc); sc_shutr(sc); - sc_ic(sc)->flags |= CF_READ_NULL; + sc_ic(sc)->flags |= CF_READ_EVENT; notification_wake(&ctx->wake_on_read); notification_wake(&ctx->wake_on_write); stream_shutdown(__sc_strm(sc), SF_ERR_KILLED); @@ -9415,7 +9415,7 @@ void hlua_applet_tcp_fct(struct appctx *ctx) /* eat the whole request */ co_skip(sc_oc(sc), co_data(sc_oc(sc))); - res->flags |= CF_READ_NULL; + res->flags |= CF_READ_EVENT; sc_shutr(sc); return; @@ -9698,7 +9698,7 @@ void hlua_applet_http_fct(struct appctx *ctx) done: if (http_ctx->flags & APPLET_DONE) { if (!(res->flags & CF_SHUTR)) { - res->flags |= CF_READ_NULL; + res->flags |= CF_READ_EVENT; sc_shutr(sc); } diff --git a/src/http_ana.c b/src/http_ana.c index 1c752d3fc8..96eb8cec64 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -1276,7 +1276,7 @@ static __inline int do_l7_retry(struct stream *s, struct stconn *sc) res = &s->res; /* Remove any write error from the request, and read error from the response */ req->flags &= ~(CF_WRITE_ERROR | CF_WRITE_TIMEOUT | CF_SHUTW | CF_SHUTW_NOW); - res->flags &= ~(CF_READ_ERROR | CF_READ_TIMEOUT | CF_SHUTR | CF_EOI | CF_READ_NULL | CF_SHUTR_NOW); + res->flags &= ~(CF_READ_ERROR | CF_READ_TIMEOUT | CF_SHUTR | CF_EOI | CF_READ_EVENT | CF_SHUTR_NOW); res->analysers &= AN_RES_FLT_END; s->conn_err_type = STRM_ET_NONE; s->flags &= ~(SF_CONN_EXP | SF_ERR_MASK | SF_FINST_MASK); diff --git a/src/log.c b/src/log.c index 61072d6ad5..3fbae30fc8 100644 --- a/src/log.c +++ b/src/log.c @@ -3689,7 +3689,7 @@ close: sc_shutw(sc); sc_shutr(sc); - sc_ic(sc)->flags |= CF_READ_NULL; + sc_ic(sc)->flags |= CF_READ_EVENT; return; } diff --git a/src/peers.c b/src/peers.c index 8fc84bc682..dd73fa2567 100644 --- a/src/peers.c +++ b/src/peers.c @@ -3195,7 +3195,7 @@ send_msgs: } sc_shutw(sc); sc_shutr(sc); - sc_ic(sc)->flags |= CF_READ_NULL; + sc_ic(sc)->flags |= CF_READ_EVENT; goto out; } } diff --git a/src/sink.c b/src/sink.c index ef3d0f0f21..3d0fda2234 100644 --- a/src/sink.c +++ b/src/sink.c @@ -446,7 +446,7 @@ static void sink_forward_io_handler(struct appctx *appctx) close: sc_shutw(sc); sc_shutr(sc); - sc_ic(sc)->flags |= CF_READ_NULL; + sc_ic(sc)->flags |= CF_READ_EVENT; } /* @@ -590,7 +590,7 @@ static void sink_forward_oc_io_handler(struct appctx *appctx) close: sc_shutw(sc); sc_shutr(sc); - sc_ic(sc)->flags |= CF_READ_NULL; + sc_ic(sc)->flags |= CF_READ_EVENT; } void __sink_forward_session_deinit(struct sink_forward_target *sft) diff --git a/src/ssl_sock.c b/src/ssl_sock.c index 5bdab8cccb..0fea7dd099 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -7344,7 +7344,7 @@ enum act_return ssl_action_wait_for_hs(struct act_rule *rule, struct proxy *px, if (conn) { if (conn->flags & (CO_FL_EARLY_SSL_HS | CO_FL_SSL_WAIT_HS)) { sc_ep_set(s->scf, SE_FL_WAIT_FOR_HS); - s->req.flags |= CF_READ_NULL; + s->req.flags |= CF_READ_EVENT; return ACT_RET_YIELD; } } diff --git a/src/stats.c b/src/stats.c index 84a4f9b6e5..47b6c060f7 100644 --- a/src/stats.c +++ b/src/stats.c @@ -4420,7 +4420,7 @@ static void http_stats_io_handler(struct appctx *appctx) if (appctx->st0 == STAT_HTTP_END) { if (!(res->flags & CF_SHUTR)) { - res->flags |= CF_READ_NULL; + res->flags |= CF_READ_EVENT; sc_shutr(sc); } diff --git a/src/stconn.c b/src/stconn.c index 178155e1ab..7bd87d5770 100644 --- a/src/stconn.c +++ b/src/stconn.c @@ -1194,7 +1194,7 @@ static void sc_notify(struct stconn *sc) /* wake the task up only when needed */ if (/* changes on the production side */ - (ic->flags & (CF_READ_NULL|CF_READ_ERROR)) || + (ic->flags & (CF_READ_EVENT|CF_READ_ERROR)) || !sc_state_in(sc->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST) || sc_ep_test(sc, SE_FL_ERROR) || ((ic->flags & CF_READ_PARTIAL) && @@ -1585,7 +1585,7 @@ static int sc_conn_recv(struct stconn *sc) ret = 1; else if (sc_ep_test(sc, SE_FL_EOS)) { /* we received a shutdown */ - ic->flags |= CF_READ_NULL; + ic->flags |= CF_READ_EVENT; if (ic->flags & CF_AUTO_CLOSE) channel_shutw_now(ic); sc_conn_read0(sc); @@ -1866,7 +1866,7 @@ static int sc_conn_process(struct stconn *sc) */ if (sc_ep_test(sc, SE_FL_EOS) && !(ic->flags & CF_SHUTR)) { /* we received a shutdown */ - ic->flags |= CF_READ_NULL; + ic->flags |= CF_READ_EVENT; if (ic->flags & CF_AUTO_CLOSE) channel_shutw_now(ic); sc_conn_read0(sc); diff --git a/src/stream.c b/src/stream.c index 04b408136f..7d69328a27 100644 --- a/src/stream.c +++ b/src/stream.c @@ -1553,8 +1553,8 @@ static void stream_update_both_sc(struct stream *s) struct channel *req = &s->req; struct channel *res = &s->res; - req->flags &= ~(CF_READ_NULL|CF_READ_PARTIAL|CF_READ_ATTACHED|CF_WRITE_NULL|CF_WRITE_PARTIAL); - res->flags &= ~(CF_READ_NULL|CF_READ_PARTIAL|CF_READ_ATTACHED|CF_WRITE_NULL|CF_WRITE_PARTIAL); + req->flags &= ~(CF_READ_EVENT|CF_READ_PARTIAL|CF_READ_ATTACHED|CF_WRITE_NULL|CF_WRITE_PARTIAL); + res->flags &= ~(CF_READ_EVENT|CF_READ_PARTIAL|CF_READ_ATTACHED|CF_WRITE_NULL|CF_WRITE_PARTIAL); s->prev_conn_state = scb->state;