BUG/MINOR: stconn: Use HTX-aware channel's functions to get info on buffer
Some channel function are used to check if the channel's buffer is full, not
empty or if there are input data. However, functions used are not
HTX-aware. So it is not accurate and may prevent some actions to be
performed (However, not sure there are really issues). Because HTX-aware
versions now exist, use them instead.
This patch may be backported as far as 2.2. It relies on
* "MINOR: channel: Add functions to get info on buffers and deal with HTX streams"
* "MINOR: htx: Use a macro for overhead induced by HTX"
(cherry picked from commit ab5ecaa2ea57aae22b22e98c7c57de5d67a3891a)
[cf: ctx adjt]
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit d114208194d81017040db33dff9df60e9e644b37)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit acd4eac0f09b5855b4ac415d2c802c173e9285cf)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit fb3dba28f3b124ddd84a3023c4d374707f85994f)
[cf: Changes applied on the stream-interface instead of the stream-connector]
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/stream_interface.c b/src/stream_interface.c
index 1d4607f..4145fd2 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -508,7 +508,7 @@
*/
if (!channel_is_empty(ic) &&
(sio->flags & SI_FL_WAIT_DATA) &&
- (!(ic->flags & CF_EXPECT_MORE) || c_full(ic) || ci_data(ic) == 0 || ic->pipe)) {
+ (!(ic->flags & CF_EXPECT_MORE) || channel_full(ic, co_data(ic)) || channel_input_data(ic) == 0)) {
int new_len, last_len;
last_len = co_data(ic);
@@ -1336,7 +1336,7 @@
if (cs->flags & CS_FL_MAY_SPLICE &&
(ic->pipe || ic->to_forward >= MIN_SPLICE_FORWARD) &&
ic->flags & CF_KERN_SPLICING) {
- if (c_data(ic)) {
+ if (channel_data(ic)) {
/* We're embarrassed, there are already data pending in
* the buffer and we don't want to have them at two
* locations at a time. Let's indicate we need some