]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] buffers: implement buffer_flush()
authorWilly Tarreau <w@1wt.eu>
Sun, 8 Mar 2009 20:12:04 +0000 (21:12 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 8 Mar 2009 20:12:04 +0000 (21:12 +0100)
This function will flush the buffer's data, which means that all data
remaining in the buffer will be scheduled for sending.

include/proto/buffers.h

index eab24f6a5af5225e278812813d6103c81f6249b2..a8f536a75143bade3a64a4551833675fd3af69f8 100644 (file)
@@ -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 <buf> and adjusts flags accordingly. Note
  * that any spliced data is not affected since we may not have any access to
  * it.