BUG/MINOR: htx: Change htx_xfer_blk() to also count metadata
This patch makes the function more accurate. Thanks to the function
htx_get_max_blksz(), the transfer of data has been simplified. Note that now the
total number of bytes copied (metadata + payload) is returned. This slighly
change how the function is used in the H2 multiplexer.
diff --git a/src/mux_h2.c b/src/mux_h2.c
index 6ecec4d..b398963 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -5379,7 +5379,6 @@
struct h2c *h2c = h2s->h2c;
struct htx *h2s_htx = NULL;
struct htx *buf_htx = NULL;
- struct htx_ret htx_ret;
size_t ret = 0;
/* transfer possibly pending data to the upper layer */
@@ -5394,6 +5393,7 @@
goto end;
}
+ ret = h2s_htx->data;
buf_htx = htx_from_buf(buf);
count = htx_free_data_space(buf_htx);
if (flags & CO_RFL_KEEP_RSV) {
@@ -5402,7 +5402,7 @@
count -= global.tune.maxrewrite;
}
- htx_ret = htx_xfer_blks(buf_htx, h2s_htx, count, HTX_BLK_EOM);
+ htx_xfer_blks(buf_htx, h2s_htx, count, HTX_BLK_EOM);
if (h2s_htx->flags & HTX_FL_PARSING_ERROR)
buf_htx->flags |= HTX_FL_PARSING_ERROR;
@@ -5410,7 +5410,7 @@
buf_htx->extra = (h2s_htx->extra ? (h2s_htx->data + h2s_htx->extra) : 0);
htx_to_buf(buf_htx, buf);
htx_to_buf(h2s_htx, &h2s->rxbuf);
- ret = htx_ret.ret;
+ ret -= h2s_htx->data;
}
else {
ret = b_xfer(buf, &h2s->rxbuf, count);