MINOR: conn-stream: Move some CS flags to the endpoint
Some CS flags, only related to the endpoint, are moved into the endpoint
struct. More will probably moved later. Those ones are not critical. So it
is pretty safe to move them now and this will ease next changes.
diff --git a/src/backend.c b/src/backend.c
index 3e16653..2f33f37 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -1749,7 +1749,7 @@
* the handshake.
*/
if (!(srv_conn->flags & (CO_FL_WAIT_XPRT | CO_FL_EARLY_SSL_HS)))
- s->csb->flags &= ~CS_FL_WAIT_FOR_HS;
+ s->csb->endp->flags &= ~CS_EP_WAIT_FOR_HS;
if (!si_state_in(cs_si(s->csb)->state, SI_SB_EST|SI_SB_DIS|SI_SB_CLO) &&
(srv_conn->flags & CO_FL_WAIT_XPRT) == 0) {
diff --git a/src/h3.c b/src/h3.c
index 59c1ae1..ec219a5 100644
--- a/src/h3.c
+++ b/src/h3.c
@@ -176,7 +176,7 @@
cs = qc_attach_cs(qcs, &htx_buf);
if (!cs)
return 1;
- cs->flags |= CS_FL_NOT_FIRST;
+ cs->endp->flags |= CS_EP_NOT_FIRST;
/* buffer is transferred to conn_stream and set to NULL
* except on stream creation error.
diff --git a/src/http_ana.c b/src/http_ana.c
index 84ddbf3..8c47770 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -5131,7 +5131,7 @@
return NULL;
s->txn = txn;
- txn->flags = ((cs && cs->flags & CS_FL_NOT_FIRST) ? TX_NOT_FIRST : 0);
+ txn->flags = ((cs && cs->endp->flags & CS_EP_NOT_FIRST) ? TX_NOT_FIRST : 0);
txn->status = -1;
txn->http_reply = NULL;
write_u32(txn->cache_hash, 0);
diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c
index aadaf96..ea956b3 100644
--- a/src/mux_fcgi.c
+++ b/src/mux_fcgi.c
@@ -3117,7 +3117,7 @@
while (node) {
fstrm = container_of(node, struct fcgi_strm, by_id);
- if (fstrm->cs && fstrm->cs->flags & CS_FL_WAIT_FOR_HS)
+ if (fstrm->cs && fstrm->cs->endp->flags & CS_EP_WAIT_FOR_HS)
fcgi_strm_notify_recv(fstrm);
node = eb32_next(node);
}
@@ -3854,7 +3854,7 @@
struct fcgi_strm *fstrm = __cs_mux(cs);
TRACE_POINT(FCGI_EV_STRM_SHUT, fstrm->fconn->conn, fstrm);
- if (cs->flags & CS_FL_KILL_CONN)
+ if (cs->endp->flags & CS_EP_KILL_CONN)
fstrm->flags |= FCGI_SF_KILL_CONN;
if (!mode)
@@ -3869,7 +3869,7 @@
struct fcgi_strm *fstrm = __cs_mux(cs);
TRACE_POINT(FCGI_EV_STRM_SHUT, fstrm->fconn->conn, fstrm);
- if (cs->flags & CS_FL_KILL_CONN)
+ if (cs->endp->flags & CS_EP_KILL_CONN)
fstrm->flags |= FCGI_SF_KILL_CONN;
fcgi_do_shutw(fstrm);
diff --git a/src/mux_h1.c b/src/mux_h1.c
index afc09df..82470bc 100644
--- a/src/mux_h1.c
+++ b/src/mux_h1.c
@@ -728,10 +728,10 @@
h1s->cs = cs;
if (h1s->flags & H1S_F_NOT_FIRST)
- cs->flags |= CS_FL_NOT_FIRST;
+ cs->endp->flags |= CS_EP_NOT_FIRST;
if (h1s->req.flags & H1_MF_UPG_WEBSOCKET)
- cs->flags |= CS_FL_WEBSOCKET;
+ cs->endp->flags |= CS_EP_WEBSOCKET;
if (!stream_new(h1c->conn->owner, cs, input)) {
TRACE_DEVEL("leaving on stream creation failure", H1_EV_STRM_NEW|H1_EV_STRM_END|H1_EV_STRM_ERR, h1c->conn, h1s);
@@ -1880,11 +1880,11 @@
/* Here h1s->cs is always defined */
if (!(h1m->flags & H1_MF_CHNK) && (h1m->state == H1_MSG_DATA || (h1m->state == H1_MSG_TUNNEL))) {
TRACE_STATE("notify the mux can use splicing", H1_EV_RX_DATA|H1_EV_RX_BODY, h1c->conn, h1s);
- h1s->cs->flags |= CS_FL_MAY_SPLICE;
+ h1s->cs->endp->flags |= CS_EP_MAY_SPLICE;
}
else {
TRACE_STATE("notify the mux can't use splicing anymore", H1_EV_RX_DATA|H1_EV_RX_BODY, h1c->conn, h1s);
- h1s->cs->flags &= ~CS_FL_MAY_SPLICE;
+ h1s->cs->endp->flags &= ~CS_EP_MAY_SPLICE;
}
/* Set EOI on conn-stream in DONE state iff:
@@ -3454,9 +3454,9 @@
TRACE_ENTER(H1_EV_STRM_SHUT, h1c->conn, h1s, 0, (size_t[]){mode});
- if (cs->flags & CS_FL_SHR)
+ if (cs->endp->flags & CS_EP_SHR)
goto end;
- if (cs->flags & CS_FL_KILL_CONN) {
+ if (cs->endp->flags & CS_EP_KILL_CONN) {
TRACE_STATE("stream wants to kill the connection", H1_EV_STRM_SHUT, h1c->conn, h1s);
goto do_shutr;
}
@@ -3477,7 +3477,7 @@
do_shutr:
/* NOTE: Be sure to handle abort (cf. h2_shutr) */
- if (cs->flags & CS_FL_SHR)
+ if (cs->endp->flags & CS_EP_SHR)
goto end;
if (conn_xprt_ready(h1c->conn) && h1c->conn->xprt->shutr)
@@ -3497,9 +3497,9 @@
TRACE_ENTER(H1_EV_STRM_SHUT, h1c->conn, h1s, 0, (size_t[]){mode});
- if (cs->flags & CS_FL_SHW)
+ if (cs->endp->flags & CS_EP_SHW)
goto end;
- if (cs->flags & CS_FL_KILL_CONN) {
+ if (cs->endp->flags & CS_EP_KILL_CONN) {
TRACE_STATE("stream wants to kill the connection", H1_EV_STRM_SHUT, h1c->conn, h1s);
goto do_shutw;
}
@@ -3643,7 +3643,7 @@
else
TRACE_DEVEL("h1c ibuf not allocated", H1_EV_H1C_RECV|H1_EV_H1C_BLK, h1c->conn);
- if ((flags & CO_RFL_BUF_FLUSH) && (cs->flags & CS_FL_MAY_SPLICE)) {
+ if ((flags & CO_RFL_BUF_FLUSH) && (cs->endp->flags & CS_EP_MAY_SPLICE)) {
h1c->flags |= H1C_F_WANT_SPLICE;
TRACE_STATE("Block xprt rcv_buf to flush stream's buffer (want_splice)", H1_EV_STRM_RECV, h1c->conn, h1s);
}
@@ -3783,7 +3783,7 @@
if (!(h1c->flags & H1C_F_WANT_SPLICE)) {
TRACE_STATE("notify the mux can't use splicing anymore", H1_EV_STRM_RECV, h1c->conn, h1s);
- cs->flags &= ~CS_FL_MAY_SPLICE;
+ cs->endp->flags &= ~CS_EP_MAY_SPLICE;
if (!(h1c->wait_event.events & SUB_RETRY_RECV)) {
TRACE_STATE("restart receiving data, subscribing", H1_EV_STRM_RECV, h1c->conn, h1s);
h1c->conn->xprt->subscribe(h1c->conn, h1c->conn->xprt_ctx, SUB_RETRY_RECV, &h1c->wait_event);
diff --git a/src/mux_h2.c b/src/mux_h2.c
index 7e7bc66..82196e9 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -1605,7 +1605,7 @@
cs = cs_new();
if (!cs)
goto out_close;
- cs->flags |= CS_FL_NOT_FIRST;
+ cs->endp->flags |= CS_EP_NOT_FIRST;
cs_attach_endp_mux(cs, h2s, h2c->conn);
h2s->cs = cs;
h2c->nb_cs++;
@@ -1614,7 +1614,7 @@
* be refine.
*/
if (flags & H2_SF_EXT_CONNECT_RCVD)
- cs->flags |= CS_FL_WEBSOCKET;
+ cs->endp->flags |= CS_EP_WEBSOCKET;
/* The stream will record the request's accept date (which is either the
* end of the connection's or the date immediately after the previous
@@ -4083,7 +4083,7 @@
while (node) {
h2s = container_of(node, struct h2s, by_id);
- if (h2s->cs && h2s->cs->flags & CS_FL_WAIT_FOR_HS)
+ if (h2s->cs && h2s->cs->endp->flags & CS_EP_WAIT_FOR_HS)
h2s_notify_recv(h2s);
node = eb32_next(node);
}
@@ -4671,7 +4671,7 @@
struct h2s *h2s = __cs_mux(cs);
TRACE_ENTER(H2_EV_STRM_SHUT, h2s->h2c->conn, h2s);
- if (cs->flags & CS_FL_KILL_CONN)
+ if (cs->endp->flags & CS_EP_KILL_CONN)
h2s->flags |= H2_SF_KILL_CONN;
if (mode)
@@ -4686,7 +4686,7 @@
struct h2s *h2s = __cs_mux(cs);
TRACE_ENTER(H2_EV_STRM_SHUT, h2s->h2c->conn, h2s);
- if (cs->flags & CS_FL_KILL_CONN)
+ if (cs->endp->flags & CS_EP_KILL_CONN)
h2s->flags |= H2_SF_KILL_CONN;
h2_do_shutw(h2s);
@@ -5325,7 +5325,7 @@
break;
}
- if (!h2s->cs || h2s->cs->flags & CS_FL_SHW) {
+ if (!h2s->cs || h2s->cs->endp->flags & CS_EP_SHW) {
/* Response already closed: add END_STREAM */
es_now = 1;
}
@@ -5745,7 +5745,7 @@
break;
}
- if (!h2s->cs || h2s->cs->flags & CS_FL_SHW) {
+ if (!h2s->cs || h2s->cs->endp->flags & CS_EP_SHW) {
/* Request already closed: add END_STREAM */
es_now = 1;
}
diff --git a/src/mux_pt.c b/src/mux_pt.c
index 1609a74..198c41a 100644
--- a/src/mux_pt.c
+++ b/src/mux_pt.c
@@ -308,7 +308,7 @@
ctx->cs = cs;
cs->flags |= CS_FL_RCV_MORE;
if (global.tune.options & GTUNE_USE_SPLICE)
- cs->flags |= CS_FL_MAY_SPLICE;
+ cs->endp->flags |= CS_EP_MAY_SPLICE;
TRACE_LEAVE(PT_EV_CONN_NEW, conn, cs);
return 0;
@@ -449,7 +449,7 @@
TRACE_ENTER(PT_EV_STRM_SHUT, conn, cs);
- if (cs->flags & CS_FL_SHR)
+ if (cs->endp->flags & CS_EP_SHR)
return;
cs->flags &= ~(CS_FL_RCV_MORE | CS_FL_WANT_ROOM);
if (conn_xprt_ready(conn) && conn->xprt->shutr)
@@ -457,7 +457,7 @@
(mode == CS_SHR_DRAIN));
else if (mode == CS_SHR_DRAIN)
conn_ctrl_drain(conn);
- if (cs->flags & CS_FL_SHW)
+ if (cs->endp->flags & CS_EP_SHW)
conn_full_close(conn);
TRACE_LEAVE(PT_EV_STRM_SHUT, conn, cs);
@@ -469,12 +469,12 @@
TRACE_ENTER(PT_EV_STRM_SHUT, conn, cs);
- if (cs->flags & CS_FL_SHW)
+ if (cs->endp->flags & CS_EP_SHW)
return;
if (conn_xprt_ready(conn) && conn->xprt->shutw)
conn->xprt->shutw(conn, conn->xprt_ctx,
(mode == CS_SHW_NORMAL));
- if (!(cs->flags & CS_FL_SHR))
+ if (!(cs->endp->flags & CS_EP_SHR))
conn_sock_shutw(conn, (mode == CS_SHW_NORMAL));
else
conn_full_close(conn);
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index c5c3df7..a6314f5 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -7739,7 +7739,7 @@
if (conn && cs) {
if (conn->flags & (CO_FL_EARLY_SSL_HS | CO_FL_SSL_WAIT_HS)) {
- cs->flags |= CS_FL_WAIT_FOR_HS;
+ cs->endp->flags |= CS_EP_WAIT_FOR_HS;
s->req.flags |= CF_READ_NULL;
return ACT_RET_YIELD;
}
diff --git a/src/stream.c b/src/stream.c
index 95e6fc5..868a3f0 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -463,7 +463,7 @@
if (likely(sess->fe->options2 & PR_O2_INDEPSTR))
cs_si(s->csb)->flags |= SI_FL_INDEP_STR;
- if (cs->flags & CS_FL_WEBSOCKET)
+ if (cs->endp->flags & CS_EP_WEBSOCKET)
s->flags |= SF_WEBSOCKET;
if (cs_conn(cs)) {
const struct mux_ops *mux = cs_conn_mux(cs);
diff --git a/src/stream_interface.c b/src/stream_interface.c
index 9396c90..4e2f7bb 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -645,8 +645,8 @@
* the handshake.
*/
if (!(conn->flags & (CO_FL_WAIT_XPRT | CO_FL_EARLY_SSL_HS)) &&
- (cs->flags & CS_FL_WAIT_FOR_HS)) {
- cs->flags &= ~CS_FL_WAIT_FOR_HS;
+ (cs->endp->flags & CS_EP_WAIT_FOR_HS)) {
+ cs->endp->flags &= ~CS_EP_WAIT_FOR_HS;
task_wakeup(si_task(si), TASK_WOKEN_MSG);
}
@@ -1072,7 +1072,7 @@
return;
if (si->flags & SI_FL_KILL_CONN)
- cs->flags |= CS_FL_KILL_CONN;
+ cs->endp->flags |= CS_EP_KILL_CONN;
if (si_oc(si)->flags & CF_SHUTW) {
cs_close(cs);
@@ -1123,7 +1123,7 @@
* no risk so we close both sides immediately.
*/
if (si->flags & SI_FL_KILL_CONN)
- cs->flags |= CS_FL_KILL_CONN;
+ cs->endp->flags |= CS_EP_KILL_CONN;
if (si->flags & SI_FL_ERR) {
/* quick close, the socket is already shut anyway */
@@ -1155,7 +1155,7 @@
* response buffer as shutr
*/
if (si->flags & SI_FL_KILL_CONN)
- cs->flags |= CS_FL_KILL_CONN;
+ cs->endp->flags |= CS_EP_KILL_CONN;
cs_close(cs);
/* fall through */
case SI_ST_CER:
@@ -1349,7 +1349,7 @@
/* First, let's see if we may splice data across the channel without
* using a buffer.
*/
- if (cs->flags & CS_FL_MAY_SPLICE &&
+ if (cs->endp->flags & CS_EP_MAY_SPLICE &&
(ic->pipe || ic->to_forward >= MIN_SPLICE_FORWARD) &&
ic->flags & CF_KERN_SPLICING) {
if (c_data(ic)) {
@@ -1404,7 +1404,7 @@
ic->pipe = NULL;
}
- if (ic->pipe && ic->to_forward && !(flags & CO_RFL_BUF_FLUSH) && cs->flags & CS_FL_MAY_SPLICE) {
+ if (ic->pipe && ic->to_forward && !(flags & CO_RFL_BUF_FLUSH) && cs->endp->flags & CS_EP_MAY_SPLICE) {
/* don't break splicing by reading, but still call rcv_buf()
* to pass the flag.
*/