}
/* Return the max number of bytes the buffer can contain so that once all the
- * pending bytes are forwarded, the buffer still has global.tune.maxrewrite
+ * data in transit are forwarded, the buffer still has global.tune.maxrewrite
* bytes free. The result sits between chn->size - maxrewrite and chn->size.
*/
-static inline int buffer_max_len(const struct channel *chn)
+static inline int channel_recv_limit(const struct channel *chn)
{
return chn->buf->size - channel_reserved(chn);
}
{
int ret;
- ret = buffer_max_len(chn) - chn->buf->i - chn->buf->o;
+ ret = channel_recv_limit(chn) - chn->buf->i - chn->buf->o;
if (ret < 0)
ret = 0;
return ret;
if (unlikely(channel_input_closed(chn)))
return -2;
- max = buffer_max_len(chn);
+ max = channel_recv_limit(chn);
if (unlikely(len > max - buffer_len(chn->buf))) {
/* we can't write this chunk right now because the buffer is
* almost full or because the block is too large. Return the
* all the part of the request which fits in a buffer is already
* there.
*/
- if (msg_len > buffer_max_len(s->req) + s->req->buf->data - s->req->buf->p)
- msg_len = buffer_max_len(s->req) + s->req->buf->data - s->req->buf->p;
+ if (msg_len > channel_recv_limit(s->req) + s->req->buf->data - s->req->buf->p)
+ msg_len = channel_recv_limit(s->req) + s->req->buf->data - s->req->buf->p;
if (bleft < msg_len)
goto too_short;