diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b4a989c..8ff5f8a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +Version 261: + +* Deduplicate `websocket::read_size_hint` definition + +-------------------------------------------------------------------------------- + Version 260: * More split compilation in rfc7230.hpp diff --git a/include/boost/beast/websocket/impl/stream.hpp b/include/boost/beast/websocket/impl/stream.hpp index 6c6a32aa..d6e57c70 100644 --- a/include/boost/beast/websocket/impl/stream.hpp +++ b/include/boost/beast/websocket/impl/stream.hpp @@ -138,12 +138,7 @@ read_size_hint(DynamicBuffer& buffer) const static_assert( net::is_dynamic_buffer::value, "DynamicBuffer type requirements not met"); - auto const initial_size = (std::min)( - +tcp_frame_size, - buffer.max_size() - buffer.size()); - if(initial_size == 0) - return 1; // buffer is full - return read_size_hint(initial_size); + return impl_->read_size_hint_db(buffer); } //------------------------------------------------------------------------------ diff --git a/include/boost/beast/websocket/impl/stream_impl.hpp b/include/boost/beast/websocket/impl/stream_impl.hpp index 2ac771f0..0deb9b21 100644 --- a/include/boost/beast/websocket/impl/stream_impl.hpp +++ b/include/boost/beast/websocket/impl/stream_impl.hpp @@ -274,13 +274,6 @@ struct stream::impl_type return key; } - std::size_t - read_size_hint(std::size_t initial_size) const - { - return this->read_size_hint_pmd( - initial_size, rd_done, rd_remain, rd_fh); - } - template std::size_t read_size_hint_db(DynamicBuffer& buffer) const @@ -290,7 +283,8 @@ struct stream::impl_type buffer.max_size() - buffer.size()); if(initial_size == 0) return 1; // buffer is full - return this->read_size_hint(initial_size); + return this->read_size_hint_pmd( + initial_size, rd_done, rd_remain, rd_fh); } template