Change consume to full buffer recreate (#899)

This commit is contained in:
Alex Kremer
2023-10-06 14:57:05 +01:00
parent c634f0f0ba
commit 4d42f7c4e4

View File

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