MINOR: stconn/channel: Move CF_READ_DONTWAIT into the SC and rename it

The channel flag CF_READ_DONTWAIT is renamed to SC_FL_RCV_ONCE and moved
into the stream-connector.
diff --git a/include/haproxy/channel-t.h b/include/haproxy/channel-t.h
index a61e4a5..0d54d8e 100644
--- a/include/haproxy/channel-t.h
+++ b/include/haproxy/channel-t.h
@@ -106,7 +106,7 @@
 #define CF_WROTE_DATA     0x00040000  /* some data were sent from this buffer */
 /* unused 0x00080000 - 0x00100000  */
 #define CF_KERN_SPLICING  0x00200000  /* kernel splicing desired for this channel */
-#define CF_READ_DONTWAIT  0x00400000  /* wake the task up after every read (eg: HTTP request) */
+/* unused 0x00400000 */
 #define CF_AUTO_CONNECT   0x00800000  /* consumer may attempt to establish a new connection */
 
 #define CF_DONT_READ      0x01000000  /* disable reading for now */
@@ -140,10 +140,10 @@
 	_(CF_WRITE_TIMEOUT,
 	_(CF_WAKE_WRITE, _(CF_SHUTW, _(CF_SHUTW_NOW, _(CF_AUTO_CLOSE,
 	_(CF_STREAMER, _(CF_STREAMER_FAST, _(CF_WROTE_DATA,
-	_(CF_KERN_SPLICING, _(CF_READ_DONTWAIT,
+	_(CF_KERN_SPLICING,
 	_(CF_AUTO_CONNECT, _(CF_DONT_READ, _(CF_EXPECT_MORE,
 	_(CF_SEND_DONTWAIT, _(CF_NEVER_WAIT, _(CF_WAKE_ONCE, _(CF_FLT_ANALYZE,
-	_(CF_EOI, _(CF_ISRESP))))))))))))))))))))))));
+	_(CF_EOI, _(CF_ISRESP)))))))))))))))))))))));
 	/* epilogue */
 	_(~0U);
 	return buf;
diff --git a/include/haproxy/stconn-t.h b/include/haproxy/stconn-t.h
index be6e3a0..7dbb655 100644
--- a/include/haproxy/stconn-t.h
+++ b/include/haproxy/stconn-t.h
@@ -125,6 +125,8 @@
 	SC_FL_WONT_READ     = 0x00000080,  /* SC doesn't want to read data */
 	SC_FL_NEED_BUFF     = 0x00000100,  /* SC waits for an rx buffer allocation to complete */
 	SC_FL_NEED_ROOM     = 0x00000200,  /* SC needs more room in the rx buffer to store incoming data */
+
+	SC_FL_RCV_ONCE      = 0x00000400,  /* Don't loop to receive data. cleared after a sucessful receive */
 };
 
 /* This function is used to report flags in debugging tools. Please reflect
@@ -139,7 +141,8 @@
 	/* flags */
 	_(SC_FL_ISBACK, _(SC_FL_NOLINGER, _(SC_FL_NOHALF,
 	_(SC_FL_DONT_WAKE, _(SC_FL_INDEP_STR, _(SC_FL_WONT_READ,
-	_(SC_FL_NEED_BUFF, _(SC_FL_NEED_ROOM))))))));
+	_(SC_FL_NEED_BUFF, _(SC_FL_NEED_ROOM,
+	_(SC_FL_RCV_ONCE)))))))));
 	/* epilogue */
 	_(~0U);
 	return buf;
diff --git a/src/cli.c b/src/cli.c
index 1178009..74d13f2 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -1039,7 +1039,7 @@
 
 			/* re-adjust req buffer */
 			co_skip(sc_oc(sc), reql);
-			req->flags |= CF_READ_DONTWAIT; /* we plan to read small requests */
+			sc_opposite(sc)->flags |= SC_FL_RCV_ONCE; /* we plan to read small requests */
 		}
 		else {	/* output functions */
 			struct cli_print_ctx *ctx;
@@ -2636,7 +2636,7 @@
 	/* We don't know yet to which server we will connect */
 	channel_dont_connect(req);
 
-	req->flags |= CF_READ_DONTWAIT;
+	s->scf->flags |= SC_FL_RCV_ONCE;
 
 	/* need more data */
 	if (!ci_data(req))
@@ -2738,7 +2738,7 @@
 		s->res.analysers &= ~AN_RES_WAIT_CLI;
 		return 0;
 	}
-	rep->flags |= CF_READ_DONTWAIT; /* try to get back here ASAP */
+	s->scb->flags |= SC_FL_RCV_ONCE; /* try to get back here ASAP */
 	rep->flags |= CF_NEVER_WAIT;
 
 	/* don't forward the close */
@@ -2869,7 +2869,7 @@
 		s->store_count = 0;
 		s->uniq_id = global.req_count++;
 
-		s->req.flags |= CF_READ_DONTWAIT; /* one read is usually enough */
+		s->scf->flags |= SC_FL_RCV_ONCE; /* one read is usually enough */
 
 		s->req.flags |= CF_WAKE_ONCE; /* need to be called again if there is some command left in the request */
 
diff --git a/src/dns.c b/src/dns.c
index 23f423f..3aca509 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -832,14 +832,13 @@
 
 	s = appctx_strm(appctx);
 	s->scb->dst = addr;
-	s->scb->flags |= SC_FL_NOLINGER;
+	s->scb->flags |= (SC_FL_RCV_ONCE|SC_FL_NOLINGER);
 	s->target = &ds->dss->srv->obj_type;
 	s->flags = SF_ASSIGNED;
 
 	s->do_log = NULL;
 	s->uniq_id = 0;
 
-	s->res.flags |= CF_READ_DONTWAIT;
 	applet_expect_no_data(appctx);
 	ds->appctx = appctx;
 	return 0;
diff --git a/src/flt_spoe.c b/src/flt_spoe.c
index 327614e..0d5d448 100644
--- a/src/flt_spoe.c
+++ b/src/flt_spoe.c
@@ -1245,7 +1245,7 @@
 	applet_need_more_data(appctx);
 
 	s->do_log = NULL;
-	s->res.flags |= CF_READ_DONTWAIT;
+	s->scb->flags |= SC_FL_RCV_ONCE;
 
 	HA_SPIN_LOCK(SPOE_APPLET_LOCK, &agent->rt[tid].lock);
 	LIST_APPEND(&agent->rt[tid].applets, &spoe_appctx->list);
diff --git a/src/frontend.c b/src/frontend.c
index 7b71357..33d66df 100644
--- a/src/frontend.c
+++ b/src/frontend.c
@@ -138,7 +138,7 @@
 	}
 
 	if (fe->mode == PR_MODE_HTTP)
-		s->req.flags |= CF_READ_DONTWAIT; /* one read is usually enough */
+		s->scf->flags |= SC_FL_RCV_ONCE; /* one read is usually enough */
 
 	if (unlikely(fe->nb_req_cap > 0)) {
 		if ((s->req_cap = pool_zalloc(fe->req_cap_pool)) == NULL)
diff --git a/src/http_ana.c b/src/http_ana.c
index bd2be1b..b8bad1e 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -1368,7 +1368,7 @@
 		}
 
 		channel_dont_close(rep);
-		rep->flags |= CF_READ_DONTWAIT; /* try to get back here ASAP */
+		s->scb->flags |= SC_FL_RCV_ONCE; /* try to get back here ASAP */
 		DBG_TRACE_DEVEL("waiting for more data",
 				STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn);
 		return 0;
diff --git a/src/http_client.c b/src/http_client.c
index a30a941..c146bd2 100644
--- a/src/http_client.c
+++ b/src/http_client.c
@@ -1071,9 +1071,8 @@
 		s->scb->dst = addr;
 	}
 
-	s->scb->flags |= SC_FL_NOLINGER;
+	s->scb->flags |= (SC_FL_RCV_ONCE|SC_FL_NOLINGER);
 	s->flags |= SF_ASSIGNED;
-	s->res.flags |= CF_READ_DONTWAIT;
 
 	/* applet is waiting for data */
 	applet_need_more_data(appctx);
diff --git a/src/peers.c b/src/peers.c
index 89e3bc7..fab92ee 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -1096,15 +1096,13 @@
 
 	/* initiate an outgoing connection */
 	s->scb->dst = addr;
-	s->scb->flags |= SC_FL_NOLINGER;
+	s->scb->flags |= (SC_FL_RCV_ONCE|SC_FL_NOLINGER);
 	s->flags = SF_ASSIGNED;
 	s->target = peer_session_target(peer, s);
 
 	s->do_log = NULL;
 	s->uniq_id = 0;
 
-	s->res.flags |= CF_READ_DONTWAIT;
-
 	_HA_ATOMIC_INC(&active_peers);
 	return 0;
 
@@ -3200,7 +3198,7 @@
 		}
 	}
 out:
-	sc_oc(sc)->flags |= CF_READ_DONTWAIT;
+	sc_opposite(sc)->flags |= SC_FL_RCV_ONCE;
 
 	if (curpeer)
 		HA_SPIN_UNLOCK(PEER_LOCK, &curpeer->lock);
diff --git a/src/sink.c b/src/sink.c
index 042e244..9cfe6ea 100644
--- a/src/sink.c
+++ b/src/sink.c
@@ -601,7 +601,7 @@
 
 	s = appctx_strm(appctx);
 	s->scb->dst = addr;
-	s->scb->flags |= SC_FL_NOLINGER;
+	s->scb->flags |= (SC_FL_RCV_ONCE|SC_FL_NOLINGER);
 
 	s->target = &sft->srv->obj_type;
 	s->flags = SF_ASSIGNED;
@@ -609,7 +609,6 @@
 	s->do_log = NULL;
 	s->uniq_id = 0;
 
-	s->res.flags |= CF_READ_DONTWAIT;
 	applet_expect_no_data(appctx);
 	sft->appctx = appctx;
 
diff --git a/src/stconn.c b/src/stconn.c
index f8dfb7a..cca4a46 100644
--- a/src/stconn.c
+++ b/src/stconn.c
@@ -1116,7 +1116,7 @@
 	}
 
 	if (ic->flags & CF_READ_EVENT)
-		ic->flags &= ~CF_READ_DONTWAIT;
+		sc->flags &= ~SC_FL_RCV_ONCE;
 }
 
 /*
@@ -1382,8 +1382,8 @@
 		if (sc_ep_test(sc, SE_FL_EOI))
 			break;
 
-		if ((ic->flags & CF_READ_DONTWAIT) || --read_poll <= 0) {
-			/* we're stopped by the channel's policy */
+		if ((sc->flags & SC_FL_RCV_ONCE) || --read_poll <= 0) {
+			/* we don't expect to read more data */
 			sc_wont_read(sc);
 			break;
 		}
diff --git a/src/stream.c b/src/stream.c
index a0007bd..8097af2 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -921,7 +921,7 @@
 		}
 	}
 	else {
-		rep->flags |= CF_READ_DONTWAIT; /* a single read is enough to get response headers */
+		s->scb->flags |= SC_FL_RCV_ONCE; /* a single read is enough to get response headers */
 	}
 
 	rep->analysers |= strm_fe(s)->fe_rsp_ana | s->be->be_rsp_ana;