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 5622b80..4fee8c3 100644
--- a/addons/promex/service-prometheus.c
+++ b/addons/promex/service-prometheus.c
@@ -1598,7 +1598,7 @@
 
 		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 @@
 	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 5cfd54f..ff764a7 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 @@
 	/* 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 604d98d..fc800b7 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -1533,7 +1533,7 @@
 
   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 79e7e5d..0d78e2d 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -1184,7 +1184,7 @@
 		 * on the response buffer.
 		 */
 		sc_shutr(sc);
-		res->flags |= CF_READ_NULL;
+		res->flags |= CF_READ_EVENT;
 	}
 
  out:
@@ -2785,7 +2785,7 @@
 		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 ee0353d..a6e6af8 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -766,7 +766,7 @@
 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 ed31943..3e4fe97 100644
--- a/src/flt_spoe.c
+++ b/src/flt_spoe.c
@@ -1303,7 +1303,7 @@
 
 		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 @@
 
 			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 a037991..722fb88 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -1989,7 +1989,7 @@
 	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 @@
 
 		/* 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 @@
   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 1c752d3..96eb8ce 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -1276,7 +1276,7 @@
 	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 61072d6..3fbae30 100644
--- a/src/log.c
+++ b/src/log.c
@@ -3689,7 +3689,7 @@
 	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 8fc84bc..dd73fa2 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -3195,7 +3195,7 @@
 				}
 				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 ef3d0f0..3d0fda2 100644
--- a/src/sink.c
+++ b/src/sink.c
@@ -446,7 +446,7 @@
 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 @@
 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 5bdab8c..0fea7dd 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -7344,7 +7344,7 @@
 	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 84a4f9b..47b6c06 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -4420,7 +4420,7 @@
 
 	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 178155e..7bd87d5 100644
--- a/src/stconn.c
+++ b/src/stconn.c
@@ -1194,7 +1194,7 @@
 
 	/* 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 @@
 		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 @@
 	 */
 	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 04b4081..7d69328 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1553,8 +1553,8 @@
 	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;