MINOR: stream-int/conn-stream: Move si_alloc_ibuf() in the conn-stream scope
si_alloc_ibuf() is renamed as c_alloc_ibuf() and update to manipulate a
conn-stream instead of a stream-interface.
diff --git a/include/haproxy/cs_utils.h b/include/haproxy/cs_utils.h
index 257fcd3..573be47 100644
--- a/include/haproxy/cs_utils.h
+++ b/include/haproxy/cs_utils.h
@@ -141,6 +141,24 @@
return !!(conn->flags & CO_FL_ERROR);
}
+/* Try to allocate a buffer for the conn-stream's input channel. It relies on
+ * channel_alloc_buffer() for this so it abides by its rules. It returns 0 on
+ * failure, non-zero otherwise. If no buffer is available, the requester,
+ * represented by the <wait> pointer, will be added in the list of objects
+ * waiting for an available buffer, and SI_FL_RXBLK_BUFF will be set on the
+ * stream-int and SI_FL_RX_WAIT_EP cleared. The requester will be responsible
+ * for calling this function to try again once woken up.
+ */
+static inline int cs_alloc_ibuf(struct conn_stream *cs, struct buffer_wait *wait)
+{
+ int ret;
+
+ ret = channel_alloc_buffer(cs_ic(cs), wait);
+ if (!ret)
+ si_rx_buff_blk(cs->si);
+ return ret;
+}
+
/* Returns the source address of the conn-stream and, if not set, fallbacks on
* the session for frontend CS and the server connection for the backend CS. It
diff --git a/include/haproxy/stream_interface.h b/include/haproxy/stream_interface.h
index 5c64367..655e30a 100644
--- a/include/haproxy/stream_interface.h
+++ b/include/haproxy/stream_interface.h
@@ -243,24 +243,6 @@
si->flags &= ~(SI_FL_WANT_GET | SI_FL_WAIT_DATA);
}
-/* Try to allocate a buffer for the stream-int's input channel. It relies on
- * channel_alloc_buffer() for this so it abides by its rules. It returns 0 on
- * failure, non-zero otherwise. If no buffer is available, the requester,
- * represented by the <wait> pointer, will be added in the list of objects
- * waiting for an available buffer, and SI_FL_RXBLK_BUFF will be set on the
- * stream-int and SI_FL_RX_WAIT_EP cleared. The requester will be responsible
- * for calling this function to try again once woken up.
- */
-static inline int si_alloc_ibuf(struct stream_interface *si, struct buffer_wait *wait)
-{
- int ret;
-
- ret = channel_alloc_buffer(si_ic(si), wait);
- if (!ret)
- si_rx_buff_blk(si);
- return ret;
-}
-
#endif /* _HAPROXY_STREAM_INTERFACE_H */
/*
diff --git a/src/applet.c b/src/applet.c
index b403c23..21da1a4 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -150,7 +150,7 @@
* some other processing if needed. The applet doesn't have anything to
* do if it needs the buffer, it will be called again upon readiness.
*/
- if (!si_alloc_ibuf(cs->si, &app->buffer_wait))
+ if (!cs_alloc_ibuf(cs, &app->buffer_wait))
si_rx_endp_more(cs->si);
count = co_data(cs_oc(cs));
diff --git a/src/hlua.c b/src/hlua.c
index fa0a211..d39732c 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -2366,7 +2366,7 @@
* the request buffer if its not required.
*/
if (s->req.buf.size == 0) {
- if (!si_alloc_ibuf(cs->si, &appctx->buffer_wait))
+ if (!cs_alloc_ibuf(cs, &appctx->buffer_wait))
goto hlua_socket_write_yield_return;
}
diff --git a/src/stream_interface.c b/src/stream_interface.c
index 85c9398..573b072 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -655,7 +655,7 @@
}
/* now we'll need a input buffer for the stream */
- if (!si_alloc_ibuf(cs->si, &(__cs_strm(cs)->buffer_wait)))
+ if (!cs_alloc_ibuf(cs, &(__cs_strm(cs)->buffer_wait)))
goto end_recv;
/* For an HTX stream, if the buffer is stuck (no output data with some