MINOR: stream-int/stream: Move si_update_both in stream scope
si_update_both() is renamed stream_update_both_cs() and moved in stream.c.
The function is slightly changed to manipulate the stream instead the front
and back conn-streams.
diff --git a/include/haproxy/cs_utils.h b/include/haproxy/cs_utils.h
index a9ed6a3..64b5e85 100644
--- a/include/haproxy/cs_utils.h
+++ b/include/haproxy/cs_utils.h
@@ -35,7 +35,6 @@
void cs_update_rx(struct conn_stream *cs);
void cs_update_tx(struct conn_stream *cs);
-void cs_update_both(struct conn_stream *csf, struct conn_stream *csb);
/* returns the channel which receives data from this conn-stream (input channel) */
static inline struct channel *cs_ic(struct conn_stream *cs)
diff --git a/src/conn_stream.c b/src/conn_stream.c
index b3738f6..6686ee4 100644
--- a/src/conn_stream.c
+++ b/src/conn_stream.c
@@ -1033,41 +1033,3 @@
}
}
}
-
-/* Updates at once the channel flags, and timers of both conn-streams of a
- * same stream, to complete the work after the analysers, then updates the data
- * layer below. This will ensure that any synchronous update performed at the
- * data layer will be reflected in the channel flags and/or conn-stream.
- * Note that this does not change the conn-stream's current state, though
- * it updates the previous state to the current one.
- */
-void cs_update_both(struct conn_stream *csf, struct conn_stream *csb)
-{
- struct channel *req = cs_ic(csf);
- struct channel *res = cs_oc(csf);
-
- 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);
-
- __cs_strm(csb)->prev_conn_state = csb->state;
-
- /* let's recompute both sides states */
- if (cs_state_in(csf->state, CS_SB_RDY|CS_SB_EST))
- cs_update(csf);
-
- if (cs_state_in(csb->state, CS_SB_RDY|CS_SB_EST))
- cs_update(csb);
-
- /* stream ints are processed outside of process_stream() and must be
- * handled at the latest moment.
- */
- if (cs_appctx(csf) &&
- ((si_rx_endp_ready(csf->si) && !si_rx_blocked(csf->si)) ||
- (si_tx_endp_ready(csf->si) && !si_tx_blocked(csf->si))))
- appctx_wakeup(__cs_appctx(csf));
-
- if (cs_appctx(csb) &&
- ((si_rx_endp_ready(csb->si) && !si_rx_blocked(csb->si)) ||
- (si_tx_endp_ready(csb->si) && !si_tx_blocked(csb->si))))
- appctx_wakeup(__cs_appctx(csb));
-}
diff --git a/src/stream.c b/src/stream.c
index 30c347b..04f7ffe 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1536,6 +1536,47 @@
}
+/* Updates at once the channel flags, and timers of both conn-streams of a
+ * same stream, to complete the work after the analysers, then updates the data
+ * layer below. This will ensure that any synchronous update performed at the
+ * data layer will be reflected in the channel flags and/or conn-stream.
+ * Note that this does not change the conn-stream's current state, though
+ * it updates the previous state to the current one.
+ */
+static void stream_update_both_cs(struct stream *s)
+{
+ struct conn_stream *csf = s->csf;
+ struct conn_stream *csb = s->csb;
+ 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);
+
+ s->prev_conn_state = csb->state;
+
+ /* let's recompute both sides states */
+ if (cs_state_in(csf->state, CS_SB_RDY|CS_SB_EST))
+ cs_update(csf);
+
+ if (cs_state_in(csb->state, CS_SB_RDY|CS_SB_EST))
+ cs_update(csb);
+
+ /* stream ints are processed outside of process_stream() and must be
+ * handled at the latest moment.
+ */
+ if (cs_appctx(csf)) {
+ if ((si_rx_endp_ready(csf->si) && !si_rx_blocked(csf->si)) ||
+ (si_tx_endp_ready(csf->si) && !si_tx_blocked(csf->si)))
+ appctx_wakeup(__cs_appctx(csf));
+ }
+ if (cs_appctx(csb)) {
+ if ((si_rx_endp_ready(csb->si) && !si_rx_blocked(csb->si)) ||
+ (si_tx_endp_ready(csb->si) && !si_tx_blocked(csb->si)))
+ appctx_wakeup(__cs_appctx(csb));
+ }
+}
+
/* This macro is very specific to the function below. See the comments in
* process_stream() below to understand the logic and the tests.
@@ -2455,7 +2496,7 @@
if ((sess->fe->options & PR_O_CONTSTATS) && (s->flags & SF_BE_ASSIGNED) && !(s->flags & SF_IGNORE))
stream_process_counters(s);
- cs_update_both(s->csf, s->csb);
+ stream_update_both_cs(s);
/* Trick: if a request is being waiting for the server to respond,
* and if we know the server can timeout, we don't want the timeout