From: Willy Tarreau Date: Sun, 8 Mar 2009 20:12:04 +0000 (+0100) Subject: [MINOR] buffers: implement buffer_flush() X-Git-Tag: v1.3.16-rc1~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8a28bf1650b4d6a610d6f22f08ddd6ae7f8bee4;p=thirdparty%2Fhaproxy.git [MINOR] buffers: implement buffer_flush() This function will flush the buffer's data, which means that all data remaining in the buffer will be scheduled for sending. --- diff --git a/include/proto/buffers.h b/include/proto/buffers.h index eab24f6a5a..a8f536a751 100644 --- a/include/proto/buffers.h +++ b/include/proto/buffers.h @@ -108,6 +108,16 @@ static inline void buffer_forward(struct buffer *buf, unsigned int bytes) buf->send_max += data_left; } +/* Schedule all remaining buffer data to be sent. send_max is not touched if it + * already covers those data. That permits doing a flush even after a forward, + * although not recommended. + */ +static inline void buffer_flush(struct buffer *buf) +{ + if (buf->send_max < buf->l) + buf->send_max = buf->l; +} + /* Erase any content from buffer and adjusts flags accordingly. Note * that any spliced data is not affected since we may not have any access to * it.