REORG: stream-int: Uninline si_sync_recv() and make si_cs_recv() private
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.
diff --git a/include/haproxy/stream_interface.h b/include/haproxy/stream_interface.h
index 673a715..89ebcda 100644
--- a/include/haproxy/stream_interface.h
+++ b/include/haproxy/stream_interface.h
@@ -47,9 +47,9 @@
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 @@
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)
{
diff --git a/src/stream_interface.c b/src/stream_interface.c
index 3b9524b..c5112df 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -92,7 +92,7 @@
/* 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 @@
}
}
+/* 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 @@
* 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);