From 4d42f7c4e4904c23ca71cd8ee68707ae2452da9a Mon Sep 17 00:00:00 2001 From: Alex Kremer Date: Fri, 6 Oct 2023 14:57:05 +0100 Subject: [PATCH] Change consume to full buffer recreate (#899) --- src/web/impl/WsBase.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/web/impl/WsBase.h b/src/web/impl/WsBase.h index ded75086a..96fc719e0 100644 --- a/src/web/impl/WsBase.h +++ b/src/web/impl/WsBase.h @@ -208,8 +208,8 @@ public: if (dead()) return; - // Clear the buffer - buffer_.consume(buffer_.size()); + // Note: use entirely new buffer so previously used, potentially large, capacity is deallocated + buffer_ = boost::beast::flat_buffer{}; derived().ws().async_read(buffer_, boost::beast::bind_front_handler(&WsBase::onRead, this->shared_from_this())); }