]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream-int/stream: Move si_update_both in stream scope
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 1 Apr 2022 12:48:06 +0000 (14:48 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 13 Apr 2022 13:10:15 +0000 (15:10 +0200)
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.

include/haproxy/cs_utils.h
src/conn_stream.c
src/stream.c

index a9ed6a31f358f96a4351c4ef384713f94f603212..64b5e855bdfc15db36786a3b9149a512e7f97c1e 100644 (file)
@@ -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)
index b3738f6dfb650fd10ed20c65567f60237aba1f29..6686ee48e8a6484cedcc5f6824acac87b5b80624 100644 (file)
@@ -1033,41 +1033,3 @@ void cs_update_tx(struct conn_stream *cs)
                }
        }
 }
-
-/* 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));
-}
index 30c347bb099ae286ea9296ae1c2c739d8e892954..04f7ffe73346f1c4413fd15e7478562b1317363a 100644 (file)
@@ -1536,6 +1536,47 @@ int stream_set_http_mode(struct stream *s, const struct mux_proto_list *mux_prot
 }
 
 
+/* 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 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
                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