]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: conn-stream: Move cs_shut* and cs_chk* in cs_utils
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 1 Apr 2022 11:58:09 +0000 (13:58 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 13 Apr 2022 13:10:15 +0000 (15:10 +0200)
cs_shutr(), cs_shutw(), cs_chk_rcv() and cs_chk_snd() are moved in
cs_utils.h

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

index bc864100e893fd0ac7029b00fae61ded97605db1..a3a44a9aa3546b6ea0a345f94352c311bc6ae992 100644 (file)
@@ -31,6 +31,7 @@
 #include <haproxy/conn_stream.h>
 #include <haproxy/session.h>
 #include <haproxy/stream.h>
+#include <haproxy/stream_interface.h>
 
 /* returns the channel which receives data from this conn-stream (input channel) */
 static inline struct channel *cs_ic(struct conn_stream *cs)
@@ -227,6 +228,46 @@ static inline void cs_must_kill_conn(struct conn_stream *cs)
        cs->endp->flags |= CS_EP_KILL_CONN;
 }
 
+
+/* Sends a shutr to the endpoint using the data layer */
+static inline void cs_shutr(struct conn_stream *cs)
+{
+       cs->ops->shutr(cs);
+}
+
+/* Sends a shutw to the endpoint using the data layer */
+static inline void cs_shutw(struct conn_stream *cs)
+{
+       cs->ops->shutw(cs);
+}
+
+/* This is to be used after making some room available in a channel. It will
+ * return without doing anything if the conn-stream's RX path is blocked.
+ * It will automatically mark the stream interface as busy processing the end
+ * point in order to avoid useless repeated wakeups.
+ * It will then call ->chk_rcv() to enable receipt of new data.
+ */
+static inline void cs_chk_rcv(struct conn_stream *cs)
+{
+       if (cs->si->flags & SI_FL_RXBLK_CONN && cs_state_in(cs_opposite(cs)->state, CS_SB_RDY|CS_SB_EST|CS_SB_DIS|CS_SB_CLO))
+               si_rx_conn_rdy(cs->si);
+
+       if (si_rx_blocked(cs->si) || !si_rx_endp_ready(cs->si))
+               return;
+
+       if (!cs_state_in(cs->state, CS_SB_RDY|CS_SB_EST))
+               return;
+
+       cs->si->flags |= SI_FL_RX_WAIT_EP;
+       cs->ops->chk_rcv(cs);
+}
+
+/* Calls chk_snd on the endpoint using the data layer */
+static inline void cs_chk_snd(struct conn_stream *cs)
+{
+       cs->ops->chk_snd(cs);
+}
+
 /* for debugging, reports the stream interface state name */
 static inline const char *cs_state_str(int state)
 {
index 3239c059dd72a709a7885069e1d1d84fdd6cd600..211d63ab673ae5b0256c99f0aa9eb91383a81313 100644 (file)
@@ -27,7 +27,6 @@
 #include <haproxy/channel.h>
 #include <haproxy/connection.h>
 #include <haproxy/conn_stream.h>
-#include <haproxy/cs_utils.h>
 #include <haproxy/obj_type.h>
 
 extern struct cs_app_ops cs_app_embedded_ops;
@@ -267,45 +266,6 @@ static inline int si_alloc_ibuf(struct stream_interface *si, struct buffer_wait
        return ret;
 }
 
-/* Sends a shutr to the endpoint using the data layer */
-static inline void cs_shutr(struct conn_stream *cs)
-{
-       cs->ops->shutr(cs);
-}
-
-/* Sends a shutw to the endpoint using the data layer */
-static inline void cs_shutw(struct conn_stream *cs)
-{
-       cs->ops->shutw(cs);
-}
-
-/* This is to be used after making some room available in a channel. It will
- * return without doing anything if the conn-stream's RX path is blocked.
- * It will automatically mark the stream interface as busy processing the end
- * point in order to avoid useless repeated wakeups.
- * It will then call ->chk_rcv() to enable receipt of new data.
- */
-static inline void cs_chk_rcv(struct conn_stream *cs)
-{
-       if (cs->si->flags & SI_FL_RXBLK_CONN && cs_state_in(cs_opposite(cs)->state, CS_SB_RDY|CS_SB_EST|CS_SB_DIS|CS_SB_CLO))
-               si_rx_conn_rdy(cs->si);
-
-       if (si_rx_blocked(cs->si) || !si_rx_endp_ready(cs->si))
-               return;
-
-       if (!cs_state_in(cs->state, CS_SB_RDY|CS_SB_EST))
-               return;
-
-       cs->si->flags |= SI_FL_RX_WAIT_EP;
-       cs->ops->chk_rcv(cs);
-}
-
-/* Calls chk_snd on the endpoint using the data layer */
-static inline void cs_chk_snd(struct conn_stream *cs)
-{
-       cs->ops->chk_snd(cs);
-}
-
 /* Combines both si_update_rx() and si_update_tx() at once */
 static inline void si_update(struct stream_interface *si)
 {
index b6b7dfded3b4e3ccf1202bdb66db1ca14aff21ae..892a582b0f2ed73836d0e4487d1e75f926ac473a 100644 (file)
@@ -14,6 +14,7 @@
 #include <haproxy/applet.h>
 #include <haproxy/connection.h>
 #include <haproxy/conn_stream.h>
+#include <haproxy/cs_utils.h>
 #include <haproxy/pool.h>
 #include <haproxy/stream_interface.h>