mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-24 23:31:40 +02:00
MEDIUM: mux: make mux->rcv_buf() take a size_t for the count
It also returns a size_t. This is in order to clean the API. Note that the H2 mux still uses some ints in the functions called from h2_rcv_buf(), though it's not really a problem given that H2 frames are smaller. It may deserve a general cleanup later though.
This commit is contained in:
parent
bfc4d77ad3
commit
d9cf540457
@ -297,7 +297,7 @@ struct mux_ops {
|
|||||||
void (*send)(struct connection *conn); /* mux-layer send callback */
|
void (*send)(struct connection *conn); /* mux-layer send callback */
|
||||||
int (*wake)(struct connection *conn); /* mux-layer callback to report activity, mandatory */
|
int (*wake)(struct connection *conn); /* mux-layer callback to report activity, mandatory */
|
||||||
void (*update_poll)(struct conn_stream *cs); /* commit cs flags to mux/conn */
|
void (*update_poll)(struct conn_stream *cs); /* commit cs flags to mux/conn */
|
||||||
int (*rcv_buf)(struct conn_stream *cs, struct buffer *buf, int count); /* Called from the upper layer to get data */
|
size_t (*rcv_buf)(struct conn_stream *cs, struct buffer *buf, size_t count); /* Called from the upper layer to get data */
|
||||||
size_t (*snd_buf)(struct conn_stream *cs, const struct buffer *buf, size_t count, int flags); /* Called from the upper layer to send data */
|
size_t (*snd_buf)(struct conn_stream *cs, const struct buffer *buf, size_t count, int flags); /* Called from the upper layer to send data */
|
||||||
int (*rcv_pipe)(struct conn_stream *cs, struct pipe *pipe, unsigned int count); /* recv-to-pipe callback */
|
int (*rcv_pipe)(struct conn_stream *cs, struct pipe *pipe, unsigned int count); /* recv-to-pipe callback */
|
||||||
int (*snd_pipe)(struct conn_stream *cs, struct pipe *pipe); /* send-to-pipe callback */
|
int (*snd_pipe)(struct conn_stream *cs, struct pipe *pipe); /* send-to-pipe callback */
|
||||||
|
@ -2920,11 +2920,11 @@ static int h2_frt_transfer_data(struct h2s *h2s, struct buffer *buf, int count)
|
|||||||
* caller is responsible for never asking for more data than what is available
|
* caller is responsible for never asking for more data than what is available
|
||||||
* in the buffer.
|
* in the buffer.
|
||||||
*/
|
*/
|
||||||
static int h2_rcv_buf(struct conn_stream *cs, struct buffer *buf, int count)
|
static size_t h2_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t count)
|
||||||
{
|
{
|
||||||
struct h2s *h2s = cs->ctx;
|
struct h2s *h2s = cs->ctx;
|
||||||
struct h2c *h2c = h2s->h2c;
|
struct h2c *h2c = h2s->h2c;
|
||||||
int ret = 0;
|
size_t ret = 0;
|
||||||
|
|
||||||
if (h2c->st0 != H2_CS_FRAME_P)
|
if (h2c->st0 != H2_CS_FRAME_P)
|
||||||
return 0; // no pre-parsed frame yet
|
return 0; // no pre-parsed frame yet
|
||||||
|
@ -159,16 +159,16 @@ static void mux_pt_shutw(struct conn_stream *cs, enum cs_shw_mode mode)
|
|||||||
/*
|
/*
|
||||||
* Called from the upper layer, to get more data
|
* Called from the upper layer, to get more data
|
||||||
*/
|
*/
|
||||||
static int mux_pt_rcv_buf(struct conn_stream *cs, struct buffer *buf, int count)
|
static size_t mux_pt_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t count)
|
||||||
{
|
{
|
||||||
int ret;
|
size_t ret;
|
||||||
|
|
||||||
ret = cs->conn->xprt->rcv_buf(cs->conn, buf, count);
|
ret = cs->conn->xprt->rcv_buf(cs->conn, buf, count);
|
||||||
if (conn_xprt_read0_pending(cs->conn))
|
if (conn_xprt_read0_pending(cs->conn))
|
||||||
cs->flags |= CS_FL_EOS;
|
cs->flags |= CS_FL_EOS;
|
||||||
if (cs->conn->flags & CO_FL_ERROR)
|
if (cs->conn->flags & CO_FL_ERROR)
|
||||||
cs->flags |= CS_FL_ERROR;
|
cs->flags |= CS_FL_ERROR;
|
||||||
return (ret);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called from the upper layer, to send data */
|
/* Called from the upper layer, to send data */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user