]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: channel: rename buffer_max_len() to channel_recv_limit()
authorWilly Tarreau <w@1wt.eu>
Wed, 14 Jan 2015 19:21:43 +0000 (20:21 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 14 Jan 2015 19:21:43 +0000 (20:21 +0100)
Buffer_max_len() is ambiguous and misleading since it considers the
channel. The new name more accurately designates the size limit for
received data.

include/proto/channel.h
src/channel.c
src/payload.c

index 1e786f37b69fe9d5bbff43e70dc9392faf7cfeb9..15ff1a95ac5d496a0ecc446f7cc3ff56f5bd71b3 100644 (file)
@@ -311,10 +311,10 @@ static inline int channel_reserved(const struct channel *chn)
 }
 
 /* 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);
 }
@@ -328,7 +328,7 @@ static inline int bi_avail(const struct channel *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;
index e9c5e12fdcadbc1e938275b4fecd234e15601b86..177ab5a88d02ff9bf27152cc18273562d8781feb 100644 (file)
@@ -157,7 +157,7 @@ int bi_putblk(struct channel *chn, const char *blk, int len)
        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
index fe9fddaedd76e7ee0f225432bc9edea483e4f2af..bc3dedd865b02d6cff123d2974228a655842e852 100644 (file)
@@ -213,8 +213,8 @@ smp_fetch_req_ssl_ver(struct proxy *px, struct session *s, void *l7, unsigned in
         * 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;