]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: stream-int: Uninline si_sync_recv() and make si_cs_recv() private
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 28 Feb 2022 08:21:58 +0000 (09:21 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 28 Feb 2022 16:16:47 +0000 (17:16 +0100)
This way si_*_recv() and si_*_sned() API are defined the same
way. si_sync_snd/si_sync_recv are both exported and defined in the C
file. And si_cs_send/si_cs_recv are private and only used by
stream-interface internals.

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

index 673a715f5fc6edcfe0ffcf8620e9d2fd6cae67c4..89ebcda3831a3705bb9b7e52632132ae7f4abd6a 100644 (file)
@@ -47,9 +47,9 @@ struct appctx *si_register_handler(struct stream_interface *si, struct applet *a
 void si_applet_wake_cb(struct stream_interface *si);
 void si_update_rx(struct stream_interface *si);
 void si_update_tx(struct stream_interface *si);
-int si_cs_recv(struct conn_stream *cs);
 struct task *si_cs_io_cb(struct task *t, void *ctx, unsigned int state);
 void si_update_both(struct stream_interface *si_f, struct stream_interface *si_b);
+int si_sync_recv(struct stream_interface *si);
 void si_sync_send(struct stream_interface *si);
 
 /* returns the channel which receives data from this stream interface (input channel) */
@@ -360,30 +360,6 @@ static inline void si_chk_rcv(struct stream_interface *si)
        si->ops->chk_rcv(si);
 }
 
-/* This tries to perform a synchronous receive on the stream interface to
- * try to collect last arrived data. In practice it's only implemented on
- * conn_streams. Returns 0 if nothing was done, non-zero if new data or a
- * shutdown were collected. This may result on some delayed receive calls
- * to be programmed and performed later, though it doesn't provide any
- * such guarantee.
- */
-static inline int si_sync_recv(struct stream_interface *si)
-{
-       if (!si_state_in(si->state, SI_SB_RDY|SI_SB_EST))
-               return 0;
-
-       if (!cs_conn_mux(si->cs))
-               return 0; // only conn_streams are supported
-
-       if (si->wait_event.events & SUB_RETRY_RECV)
-               return 0; // already subscribed
-
-       if (!si_rx_endp_ready(si) || si_rx_blocked(si))
-               return 0; // already failed
-
-       return si_cs_recv(si->cs);
-}
-
 /* Calls chk_snd on the connection using the data layer */
 static inline void si_chk_snd(struct stream_interface *si)
 {
index 3b9524b5137008b8c344d3c163559e65ff99bdae..c5112dfe583d872101f186679eb066499e3f90d9 100644 (file)
@@ -92,7 +92,7 @@ struct si_ops si_applet_ops = {
 /* Functions used to communicate with a conn_stream. The first two may be used
  * directly, the last one is mostly a wake callback.
  */
-int si_cs_recv(struct conn_stream *cs);
+static int si_cs_recv(struct conn_stream *cs);
 static int si_cs_send(struct conn_stream *cs);
 static int si_cs_process(struct conn_stream *cs);
 
@@ -938,6 +938,30 @@ void si_update_tx(struct stream_interface *si)
        }
 }
 
+/* This tries to perform a synchronous receive on the stream interface to
+ * try to collect last arrived data. In practice it's only implemented on
+ * conn_streams. Returns 0 if nothing was done, non-zero if new data or a
+ * shutdown were collected. This may result on some delayed receive calls
+ * to be programmed and performed later, though it doesn't provide any
+ * such guarantee.
+ */
+int si_sync_recv(struct stream_interface *si)
+{
+       if (!si_state_in(si->state, SI_SB_RDY|SI_SB_EST))
+               return 0;
+
+       if (!cs_conn_mux(si->cs))
+               return 0; // only conn_streams are supported
+
+       if (si->wait_event.events & SUB_RETRY_RECV)
+               return 0; // already subscribed
+
+       if (!si_rx_endp_ready(si) || si_rx_blocked(si))
+               return 0; // already failed
+
+       return si_cs_recv(si->cs);
+}
+
 /* perform a synchronous send() for the stream interface. The CF_WRITE_NULL and
  * CF_WRITE_PARTIAL flags are cleared prior to the attempt, and will possibly
  * be updated in case of success.
@@ -1245,7 +1269,7 @@ static void stream_int_chk_snd_conn(struct stream_interface *si)
  * into the buffer from the connection. It iterates over the mux layer's
  * rcv_buf function.
  */
-int si_cs_recv(struct conn_stream *cs)
+static int si_cs_recv(struct conn_stream *cs)
 {
        struct connection *conn = __cs_conn(cs);
        struct stream_interface *si = cs_si(cs);