From 33b230b34ae4f0646b6d16576b8d394b5153ae8f Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 4 Oct 2009 09:16:41 +0200 Subject: [PATCH] [BUG] stats: don't call buffer_shutw(), but ->shutw() instead Calling buffer_shutw() marks the buffer as closed but if it was already closed in the other direction, the stream interface is not marked as closed, causing infinite loops. We took this opportunity to completely remove buffer_shutw() and buffer_shutr() which have no reason to be used at all and which will always cause trouble when directly called. The stats occurrence was the last one. --- include/proto/buffers.h | 14 -------------- src/dumpstats.c | 7 +++---- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/include/proto/buffers.h b/include/proto/buffers.h index a20ae8ba14..cec7b02fbb 100644 --- a/include/proto/buffers.h +++ b/include/proto/buffers.h @@ -163,20 +163,6 @@ static inline void buffer_cut_tail(struct buffer *buf) buf->flags |= BF_FULL; } -/* marks the buffer as "shutdown" for reads and cancels the timeout */ -static inline void buffer_shutr(struct buffer *buf) -{ - buf->rex = TICK_ETERNITY; - buf->flags |= BF_SHUTR; -} - -/* marks the buffer as "shutdown" for writes and cancels the timeout */ -static inline void buffer_shutw(struct buffer *buf) -{ - buf->wex = TICK_ETERNITY; - buf->flags |= BF_SHUTW; -} - /* marks the buffer as "shutdown" ASAP for reads */ static inline void buffer_shutr_now(struct buffer *buf) { diff --git a/src/dumpstats.c b/src/dumpstats.c index f9d8785b4d..b34b849978 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -467,11 +467,10 @@ void stats_io_handler(struct stream_interface *si) s->ana_state = STATS_ST_REQ; } else if (s->ana_state == STATS_ST_CLOSE) { - /* let's close for real now. Note that we may as well - * call shutw+shutr, but this is enough since the shut - * conditions below will complete. + /* Let's close for real now. We just close the request + * side, the conditions below will complete if needed. */ - buffer_shutw(si->ob); + si->shutw(si); s->ana_state = 0; break; }