]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MEDIUM] don't report buffer timeout when there is I/O activity
authorWilly Tarreau <w@1wt.eu>
Sat, 13 Dec 2008 21:25:59 +0000 (22:25 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 28 Dec 2008 09:58:52 +0000 (10:58 +0100)
We don't want to report a buffer timeout if there was I/O activity
for the same events. That way we'll not have to always re-arm timeouts
on I/O, without the fear of a timeout triggering too fast.

include/proto/buffers.h

index 37f724ab7125db494d1db444b6ae2194dea7f62d..be1c9492a24ae2f690e83d4bf54eb9a096ea4bc0 100644 (file)
@@ -67,14 +67,17 @@ static inline int buffer_isfull(const struct buffer *buf) {
 
 /* Check buffer timeouts, and set the corresponding flags. The
  * likely/unlikely have been optimized for fastest normal path.
+ * The read/write timeouts are not set if there was activity on the buffer.
+ * That way, we don't have to update the timeout on every I/O. Note that the
+ * analyser timeout is always checked.
  */
 static inline void buffer_check_timeouts(struct buffer *b)
 {
-       if (likely(!(b->flags & (BF_SHUTR|BF_READ_TIMEOUT))) &&
+       if (likely(!(b->flags & (BF_SHUTR|BF_READ_TIMEOUT|BF_READ_ACTIVITY))) &&
            unlikely(tick_is_expired(b->rex, now_ms)))
                b->flags |= BF_READ_TIMEOUT;
 
-       if (likely(!(b->flags & (BF_SHUTW|BF_WRITE_TIMEOUT))) &&
+       if (likely(!(b->flags & (BF_SHUTW|BF_WRITE_TIMEOUT|BF_WRITE_ACTIVITY))) &&
            unlikely(tick_is_expired(b->wex, now_ms)))
                b->flags |= BF_WRITE_TIMEOUT;