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_h2.c b/src/mux_h2.c
index 2251a8e..4a39b51 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -3378,10 +3378,9 @@
}
/* Called from the upper layer, to send data */
-static int h2_snd_buf(struct conn_stream *cs, struct buffer *buf, int flags)
+static size_t h2_snd_buf(struct conn_stream *cs, const struct buffer *buf, size_t count, int flags)
{
struct h2s *h2s = cs->ctx;
- size_t count = buf->o;
size_t total = 0;
size_t ret;
@@ -3452,7 +3451,6 @@
LIST_ADDQ(&h2s->h2c->send_list, &h2s->list);
}
- b_del(buf, total);
return total;
}