diff --git a/include/haproxy/stconn.h b/include/haproxy/stconn.h index 3b24b217e..4e8722e4a 100644 --- a/include/haproxy/stconn.h +++ b/include/haproxy/stconn.h @@ -457,13 +457,13 @@ static inline void sc_have_room(struct stconn *sc) * SE_FL_HAVE_NO_DATA to be called again as soon as SC_FL_NEED_ROOM is cleared. * * The caller is responsible to specified the amount of free space required to - * progress. However, to be sure the SC can be unblocked a max value cannot be - * eceeded : (BUFSIZE - RESERVE - HTX OVERHEAD) + * progress. It must take care to not exceed the buffer size. */ static inline void sc_need_room(struct stconn *sc, ssize_t room_needed) { sc->flags |= SC_FL_NEED_ROOM; - sc->room_needed = MIN((ssize_t)(global.tune.bufsize - global.tune.maxrewrite - sizeof(struct htx)), room_needed); + BUG_ON_HOT(room_needed > (ssize_t)global.tune.bufsize); + sc->room_needed = room_needed; } /* The stream endpoint indicates that it's ready to consume data from the