diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d443831..22f1be72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ WebSocket: * Fix utf8 check split code point at buffer end * Refactor stream operations and tests plus coverage +* Suspended ops special members -------------------------------------------------------------------------------- diff --git a/include/boost/beast/websocket/detail/pausation.hpp b/include/boost/beast/websocket/detail/pausation.hpp index c36ae86c..82f7a854 100644 --- a/include/boost/beast/websocket/detail/pausation.hpp +++ b/include/boost/beast/websocket/detail/pausation.hpp @@ -32,9 +32,9 @@ class pausation struct base { base() = default; - base(base &&) = default; + base(base &&) = delete; + base(base const&) = delete; virtual ~base() = default; - virtual base* move(void* p) = 0; virtual void operator()() = 0; }; @@ -52,12 +52,6 @@ class pausation { } - base* - move(void* p) override - { - return ::new(p) holder(std::move(*this)); - } - void operator()() override { @@ -97,10 +91,10 @@ class pausation using boost::asio::asio_handler_deallocate; if(op_) { - auto h = std::move(op_->handler()); + Op op(std::move(*op_)); op_->~Op(); asio_handler_deallocate(op_, - sizeof(*op_), std::addressof(h)); + sizeof(*op_), std::addressof(op.handler())); } } @@ -146,36 +140,26 @@ class pausation alignas(holder) buf_type buf_; public: + pausation() = default; + pausation(pausation const&) = delete; + pausation& operator=(pausation const&) = delete; + ~pausation() { if(base_) base_->~base(); } - pausation() = default; - pausation(pausation&& other) { - if(other.base_) - { - base_ = other.base_->move(buf_); - other.base_ = nullptr; - } + BOOST_ASSERT(! other.base_); } pausation& operator=(pausation&& other) { - // Engaged pausations must be invoked before - // assignment otherwise the io_service - // completion invariants are broken. BOOST_ASSERT(! base_); - - if(other.base_) - { - base_ = other.base_->move(buf_); - other.base_ = nullptr; - } + BOOST_ASSERT(! other.base_); return *this; }