From 2d028db75a8a214557319d3f9898bfbcf384ddf7 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 20 Sep 2009 22:56:25 +0200 Subject: [PATCH] [BUG] buffers: buffer_forward() must not always clear BF_OUT_EMPTY This flag was unconditionally cleared, which is wrong because we can enable forwarding on an empty buffer. --- include/proto/buffers.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/proto/buffers.h b/include/proto/buffers.h index abaf5eeb5..432146c92 100644 --- a/include/proto/buffers.h +++ b/include/proto/buffers.h @@ -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;