[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.
This commit is contained in:
Willy Tarreau 2009-10-04 09:16:41 +02:00
parent f27b5ea8dc
commit 33b230b34a
2 changed files with 3 additions and 18 deletions

View File

@ -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)
{

View File

@ -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;
}