Deduplicate websocket::read_size_hint definition

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
This commit is contained in:
Damian Jarek
2019-06-25 04:21:52 +02:00
parent 10b8f90749
commit fea681b459
3 changed files with 9 additions and 14 deletions

View File

@ -1,3 +1,9 @@
Version 261:
* Deduplicate `websocket::read_size_hint` definition
--------------------------------------------------------------------------------
Version 260: Version 260:
* More split compilation in rfc7230.hpp * More split compilation in rfc7230.hpp

View File

@ -138,12 +138,7 @@ read_size_hint(DynamicBuffer& buffer) const
static_assert( static_assert(
net::is_dynamic_buffer<DynamicBuffer>::value, net::is_dynamic_buffer<DynamicBuffer>::value,
"DynamicBuffer type requirements not met"); "DynamicBuffer type requirements not met");
auto const initial_size = (std::min)( return impl_->read_size_hint_db(buffer);
+tcp_frame_size,
buffer.max_size() - buffer.size());
if(initial_size == 0)
return 1; // buffer is full
return read_size_hint(initial_size);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -274,13 +274,6 @@ struct stream<NextLayer, deflateSupported>::impl_type
return key; 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<class DynamicBuffer> template<class DynamicBuffer>
std::size_t std::size_t
read_size_hint_db(DynamicBuffer& buffer) const read_size_hint_db(DynamicBuffer& buffer) const
@ -290,7 +283,8 @@ struct stream<NextLayer, deflateSupported>::impl_type
buffer.max_size() - buffer.size()); buffer.max_size() - buffer.size());
if(initial_size == 0) if(initial_size == 0)
return 1; // buffer is full 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<class DynamicBuffer> template<class DynamicBuffer>