]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] buffers: buffer_forward() must not always clear BF_OUT_EMPTY
authorWilly Tarreau <w@1wt.eu>
Sun, 20 Sep 2009 20:56:25 +0000 (22:56 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 21 Sep 2009 04:25:15 +0000 (06:25 +0200)
This flag was unconditionally cleared, which is wrong because we
can enable forwarding on an empty buffer.

include/proto/buffers.h

index abaf5eeb58ccccb332ea3e818cbb21b879bd0bf1..432146c92cb6031d493489eb550dccebc066c2a7 100644 (file)
@@ -91,14 +91,17 @@ static inline void buffer_forward(struct buffer *buf, unsigned long bytes)
 
        if (!bytes)
                return;
-       buf->flags &= ~BF_OUT_EMPTY;
        data_left = buf->l - buf->send_max;
        if (data_left >= bytes) {
                buf->send_max += bytes;
+               buf->flags &= ~BF_OUT_EMPTY;
                return;
        }
 
        buf->send_max += data_left;
+       if (buf->send_max)
+               buf->flags &= ~BF_OUT_EMPTY;
+
        if (buf->to_forward == BUF_INFINITE_FORWARD)
                return;