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.
This commit is contained in:
parent
446d8037ce
commit
6e1bbc446b
@ -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);
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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:
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user