MINOR: connection: add a flags argument to rcv_buf()
The mux and transport rcv_buf() now takes a "flags" argument, just like
the snd_buf() one or like the equivalent syscall lower part. The upper
layers will use this to pass some information such as indicating whether
the buffer is free from outgoing data or if the lower layer may allocate
the buffer itself.
diff --git a/src/checks.c b/src/checks.c
index 9cbc5de..a499f23 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -824,7 +824,7 @@
done = 0;
- conn->mux->rcv_buf(cs, check->bi, check->bi->size);
+ conn->mux->rcv_buf(cs, check->bi, check->bi->size, 0);
if (conn->flags & (CO_FL_ERROR | CO_FL_SOCK_RD_SH) || cs->flags & CS_FL_ERROR) {
done = 1;
if ((conn->flags & CO_FL_ERROR || cs->flags & CS_FL_ERROR) && !check->bi->i) {
@@ -2889,7 +2889,7 @@
goto out_end_tcpcheck;
__cs_want_recv(cs);
- if (conn->mux->rcv_buf(cs, check->bi, check->bi->size) <= 0) {
+ if (conn->mux->rcv_buf(cs, check->bi, check->bi->size, 0) <= 0) {
if (conn->flags & (CO_FL_ERROR | CO_FL_SOCK_RD_SH) || cs->flags & CS_FL_ERROR) {
done = 1;
if ((conn->flags & CO_FL_ERROR || cs->flags & CS_FL_ERROR) && !check->bi->i) {
diff --git a/src/mux_h2.c b/src/mux_h2.c
index 2895839..250eae2 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -2154,7 +2154,7 @@
/* note: buf->o == 0 */
max = buf->size - buf->i;
if (max)
- conn->xprt->rcv_buf(conn, buf, max);
+ conn->xprt->rcv_buf(conn, buf, max, 0);
if (!buf->i) {
h2_release_buf(h2c, &h2c->dbuf);
@@ -2920,7 +2920,7 @@
* caller is responsible for never asking for more data than what is available
* in the buffer.
*/
-static size_t h2_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t count)
+static size_t h2_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t count, int flags)
{
struct h2s *h2s = cs->ctx;
struct h2c *h2c = h2s->h2c;
diff --git a/src/mux_pt.c b/src/mux_pt.c
index aa03fd4..b6d0b1a 100644
--- a/src/mux_pt.c
+++ b/src/mux_pt.c
@@ -159,11 +159,11 @@
/*
* Called from the upper layer, to get more data
*/
-static size_t mux_pt_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t count)
+static size_t mux_pt_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t count, int flags)
{
size_t ret;
- ret = cs->conn->xprt->rcv_buf(cs->conn, buf, count);
+ ret = cs->conn->xprt->rcv_buf(cs->conn, buf, count, flags);
if (conn_xprt_read0_pending(cs->conn))
cs->flags |= CS_FL_EOS;
if (cs->conn->flags & CO_FL_ERROR)
diff --git a/src/raw_sock.c b/src/raw_sock.c
index daf3d07..477862e 100644
--- a/src/raw_sock.c
+++ b/src/raw_sock.c
@@ -250,7 +250,7 @@
* errno is cleared before starting so that the caller knows that if it spots an
* error without errno, it's pending and can be retrieved via getsockopt(SO_ERROR).
*/
-static size_t raw_sock_to_buf(struct connection *conn, struct buffer *buf, size_t count)
+static size_t raw_sock_to_buf(struct connection *conn, struct buffer *buf, size_t count, int flags)
{
ssize_t ret;
size_t try, done = 0;
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 20b7cdf..42cb72f 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -5337,7 +5337,7 @@
* avoiding the call if inappropriate. The function does not call the
* connection's polling update function, so the caller is responsible for this.
*/
-static size_t ssl_sock_to_buf(struct connection *conn, struct buffer *buf, size_t count)
+static size_t ssl_sock_to_buf(struct connection *conn, struct buffer *buf, size_t count, int flags)
{
ssize_t ret;
size_t try, done = 0;
diff --git a/src/stream_interface.c b/src/stream_interface.c
index 4a095d8..0afcb97 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -1189,7 +1189,7 @@
break;
}
- ret = conn->mux->rcv_buf(cs, ic->buf, max);
+ ret = conn->mux->rcv_buf(cs, ic->buf, max, 0);
if (cs->flags & CS_FL_RCV_MORE)
si->flags |= SI_FL_WAIT_ROOM;