mirror of
https://github.com/boostorg/beast.git
synced 2025-08-02 14:24:31 +02:00
flat_static_buffer improvements (API Change):
* Revise documentation * Specify exception safety * Mark more functions noexcept API Changes: * flat_static_buffer::reset is deprecated Actions Required: * Replace calls to flat_static_buffer::reset with flat_static_buffer::clear
This commit is contained in:
@@ -3,16 +3,21 @@ Version 198:
|
|||||||
* flat_buffer improvements
|
* flat_buffer improvements
|
||||||
* multi_buffer improvements
|
* multi_buffer improvements
|
||||||
* static_buffer improvements
|
* static_buffer improvements
|
||||||
|
* flat_static_buffer_improvements
|
||||||
|
|
||||||
API Changes:
|
API Changes:
|
||||||
|
|
||||||
* Files return errc::bad_file_descriptor
|
* Files return errc::bad_file_descriptor
|
||||||
|
* flat_static_buffer::reset is deprecated
|
||||||
|
|
||||||
Actions Required:
|
Actions Required:
|
||||||
|
|
||||||
* Callers checking for errc::invalid_argument from calls to
|
* Callers checking for errc::invalid_argument from calls to
|
||||||
file APIs should check for errc::bad_file_descriptor instead.
|
file APIs should check for errc::bad_file_descriptor instead.
|
||||||
|
|
||||||
|
* Replace calls to flat_static_buffer::reset with
|
||||||
|
flat_static_buffer::clear
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
Version 197:
|
Version 197:
|
||||||
|
@@ -81,13 +81,22 @@ public:
|
|||||||
void
|
void
|
||||||
clear() noexcept;
|
clear() noexcept;
|
||||||
|
|
||||||
// VFALCO Deprecate this
|
#ifdef BOOST_BEAST_ALLOW_DEPRECATED
|
||||||
/// Change the number of readable and writable bytes to zero.
|
/// Change the number of readable and writable bytes to zero.
|
||||||
void
|
void
|
||||||
reset() noexcept
|
reset() noexcept
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
#elif ! BOOST_BEAST_DOXYGEN
|
||||||
|
template<std::size_t I = 0>
|
||||||
|
void
|
||||||
|
reset() noexcept
|
||||||
|
{
|
||||||
|
static_assert(sizeof(I) != 0,
|
||||||
|
BOOST_BEAST_DEPRECATION_STRING);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -154,6 +163,10 @@ public:
|
|||||||
sequence.
|
sequence.
|
||||||
|
|
||||||
@throws std::length_error if `size() + n` exceeds `max_size()`.
|
@throws std::length_error if `size() + n` exceeds `max_size()`.
|
||||||
|
|
||||||
|
@par Exception Safety
|
||||||
|
|
||||||
|
Strong guarantee.
|
||||||
*/
|
*/
|
||||||
inline
|
inline
|
||||||
mutable_buffers_type
|
mutable_buffers_type
|
||||||
@@ -172,6 +185,10 @@ public:
|
|||||||
@param n The number of bytes to append. If this number
|
@param n The number of bytes to append. If this number
|
||||||
is greater than the number of writable bytes, all
|
is greater than the number of writable bytes, all
|
||||||
writable bytes are appended.
|
writable bytes are appended.
|
||||||
|
|
||||||
|
@par Exception Safety
|
||||||
|
|
||||||
|
No-throw guarantee.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
commit(std::size_t n) noexcept
|
commit(std::size_t n) noexcept
|
||||||
@@ -189,6 +206,10 @@ public:
|
|||||||
@param n The number of bytes to remove. If this number
|
@param n The number of bytes to remove. If this number
|
||||||
is greater than the number of readable bytes, all
|
is greater than the number of readable bytes, all
|
||||||
readable bytes are removed.
|
readable bytes are removed.
|
||||||
|
|
||||||
|
@par Exception Safety
|
||||||
|
|
||||||
|
No-throw guarantee.
|
||||||
*/
|
*/
|
||||||
inline
|
inline
|
||||||
void
|
void
|
||||||
@@ -213,6 +234,10 @@ protected:
|
|||||||
@param p A pointer to valid storage of at least `n` bytes.
|
@param p A pointer to valid storage of at least `n` bytes.
|
||||||
|
|
||||||
@param n The number of valid bytes pointed to by `p`.
|
@param n The number of valid bytes pointed to by `p`.
|
||||||
|
|
||||||
|
@par Exception Safety
|
||||||
|
|
||||||
|
No-throw guarantee.
|
||||||
*/
|
*/
|
||||||
inline
|
inline
|
||||||
void
|
void
|
||||||
|
@@ -63,7 +63,7 @@ do_context_takeover_read(role_type role)
|
|||||||
(role == role_type::server &&
|
(role == role_type::server &&
|
||||||
pmd_config_.client_no_context_takeover))
|
pmd_config_.client_no_context_takeover))
|
||||||
{
|
{
|
||||||
pmd_->zi.reset();
|
pmd_->zi.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,7 +304,7 @@ operator()(
|
|||||||
if(ws_.ctrl_cb_)
|
if(ws_.ctrl_cb_)
|
||||||
ws_.ctrl_cb_(
|
ws_.ctrl_cb_(
|
||||||
frame_type::ping, payload);
|
frame_type::ping, payload);
|
||||||
ws_.rd_fb_.reset();
|
ws_.rd_fb_.clear();
|
||||||
ws_.template write_ping<
|
ws_.template write_ping<
|
||||||
flat_static_buffer_base>(ws_.rd_fb_,
|
flat_static_buffer_base>(ws_.rd_fb_,
|
||||||
detail::opcode::pong, payload);
|
detail::opcode::pong, payload);
|
||||||
@@ -656,7 +656,7 @@ operator()(
|
|||||||
ws_.wr_close_ = true;
|
ws_.wr_close_ = true;
|
||||||
|
|
||||||
// Serialize close frame
|
// Serialize close frame
|
||||||
ws_.rd_fb_.reset();
|
ws_.rd_fb_.clear();
|
||||||
ws_.template write_close<
|
ws_.template write_close<
|
||||||
flat_static_buffer_base>(
|
flat_static_buffer_base>(
|
||||||
ws_.rd_fb_, code_);
|
ws_.rd_fb_, code_);
|
||||||
|
@@ -341,7 +341,7 @@ operator()(
|
|||||||
{
|
{
|
||||||
fh_.fin = fin_;
|
fh_.fin = fin_;
|
||||||
fh_.len = buffer_size(cb_);
|
fh_.len = buffer_size(cb_);
|
||||||
ws_.wr_fb_.reset();
|
ws_.wr_fb_.clear();
|
||||||
detail::write<flat_static_buffer_base>(
|
detail::write<flat_static_buffer_base>(
|
||||||
ws_.wr_fb_, fh_);
|
ws_.wr_fb_, fh_);
|
||||||
ws_.wr_cont_ = ! fin_;
|
ws_.wr_cont_ = ! fin_;
|
||||||
@@ -366,7 +366,7 @@ operator()(
|
|||||||
fh_.len = n;
|
fh_.len = n;
|
||||||
remain_ -= n;
|
remain_ -= n;
|
||||||
fh_.fin = fin_ ? remain_ == 0 : false;
|
fh_.fin = fin_ ? remain_ == 0 : false;
|
||||||
ws_.wr_fb_.reset();
|
ws_.wr_fb_.clear();
|
||||||
detail::write<flat_static_buffer_base>(
|
detail::write<flat_static_buffer_base>(
|
||||||
ws_.wr_fb_, fh_);
|
ws_.wr_fb_, fh_);
|
||||||
ws_.wr_cont_ = ! fin_;
|
ws_.wr_cont_ = ! fin_;
|
||||||
@@ -409,7 +409,7 @@ operator()(
|
|||||||
fh_.len = remain_;
|
fh_.len = remain_;
|
||||||
fh_.key = ws_.create_mask();
|
fh_.key = ws_.create_mask();
|
||||||
detail::prepare_key(key_, fh_.key);
|
detail::prepare_key(key_, fh_.key);
|
||||||
ws_.wr_fb_.reset();
|
ws_.wr_fb_.clear();
|
||||||
detail::write<flat_static_buffer_base>(
|
detail::write<flat_static_buffer_base>(
|
||||||
ws_.wr_fb_, fh_);
|
ws_.wr_fb_, fh_);
|
||||||
n = clamp(remain_, ws_.wr_buf_size_);
|
n = clamp(remain_, ws_.wr_buf_size_);
|
||||||
@@ -466,7 +466,7 @@ operator()(
|
|||||||
ws_.wr_buf_.get(), n), cb_);
|
ws_.wr_buf_.get(), n), cb_);
|
||||||
detail::mask_inplace(buffer(
|
detail::mask_inplace(buffer(
|
||||||
ws_.wr_buf_.get(), n), key_);
|
ws_.wr_buf_.get(), n), key_);
|
||||||
ws_.wr_fb_.reset();
|
ws_.wr_fb_.clear();
|
||||||
detail::write<flat_static_buffer_base>(
|
detail::write<flat_static_buffer_base>(
|
||||||
ws_.wr_fb_, fh_);
|
ws_.wr_fb_, fh_);
|
||||||
ws_.wr_cont_ = ! fin_;
|
ws_.wr_cont_ = ! fin_;
|
||||||
@@ -529,7 +529,7 @@ operator()(
|
|||||||
}
|
}
|
||||||
fh_.fin = ! more_;
|
fh_.fin = ! more_;
|
||||||
fh_.len = n;
|
fh_.len = n;
|
||||||
ws_.wr_fb_.reset();
|
ws_.wr_fb_.clear();
|
||||||
detail::write<
|
detail::write<
|
||||||
flat_static_buffer_base>(ws_.wr_fb_, fh_);
|
flat_static_buffer_base>(ws_.wr_fb_, fh_);
|
||||||
ws_.wr_cont_ = ! fin_;
|
ws_.wr_cont_ = ! fin_;
|
||||||
|
Reference in New Issue
Block a user