MEDIUM: mux: make mux->snd_buf() take the byte count in argument
This way the mux doesn't need to modify the buffer's metadata anymore
nor to know the output's size. The mux->snd_buf() function now takes a
const buffer and it's up to the caller to update the buffer's state.
The return type was updated to return a size_t to comply with the count
argument.
diff --git a/src/mux_pt.c b/src/mux_pt.c
index 688b7d8..d65c4e2 100644
--- a/src/mux_pt.c
+++ b/src/mux_pt.c
@@ -172,15 +172,9 @@
}
/* Called from the upper layer, to send data */
-static int mux_pt_snd_buf(struct conn_stream *cs, struct buffer *buf, int flags)
+static size_t mux_pt_snd_buf(struct conn_stream *cs, const struct buffer *buf, size_t count, int flags)
{
- int ret = cs->conn->xprt->snd_buf(cs->conn, buf, buf->o, flags);
-
- if (ret > 0)
- b_del(buf, ret);
-
- b_realign_if_empty(buf);
- return ret;
+ return cs->conn->xprt->snd_buf(cs->conn, buf, count, flags);
}
#if defined(CONFIG_HAP_LINUX_SPLICE)