X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fboost%2Fboost%2Fbeast%2Fcore%2Fdetail%2Fstream_base.hpp;h=e6e806202b96c5b09855351aab263e0f314850a3;hb=20effc670b57271cb089376d6d0800990e5218d5;hp=3f675d47f954db02571281951dc34a7f2e8d0e40;hpb=a71831dadd1e1f3e0fa70405511f65cc33db0498;p=ceph.git diff --git a/ceph/src/boost/boost/beast/core/detail/stream_base.hpp b/ceph/src/boost/boost/beast/core/detail/stream_base.hpp index 3f675d47f..e6e806202 100644 --- a/ceph/src/boost/boost/beast/core/detail/stream_base.hpp +++ b/ceph/src/boost/boost/beast/core/detail/stream_base.hpp @@ -56,19 +56,25 @@ struct stream_base class pending_guard { - bool& b_; + bool* b_ = nullptr; bool clear_ = true; public: ~pending_guard() { - if(clear_) - b_ = false; + if(clear_ && b_) + *b_ = false; + } + + pending_guard() + : b_(nullptr) + , clear_(true) + { } explicit pending_guard(bool& b) - : b_(b) + : b_(&b) { // If this assert goes off, it means you are attempting // to issue two of the same asynchronous I/O operation @@ -77,8 +83,8 @@ struct stream_base // calls to async_read_some. Only one pending call of // each I/O type (read and write) is permitted. // - BOOST_ASSERT(! b_); - b_ = true; + BOOST_ASSERT(! *b_); + *b_ = true; } pending_guard( @@ -89,11 +95,29 @@ struct stream_base { } + void assign(bool& b) + { + BOOST_ASSERT(!b_); + BOOST_ASSERT(clear_); + b_ = &b; + + // If this assert goes off, it means you are attempting + // to issue two of the same asynchronous I/O operation + // at the same time, without waiting for the first one + // to complete. For example, attempting two simultaneous + // calls to async_read_some. Only one pending call of + // each I/O type (read and write) is permitted. + // + BOOST_ASSERT(! *b_); + *b_ = true; + } + void reset() { BOOST_ASSERT(clear_); - b_ = false; + if (b_) + *b_ = false; clear_ = false; } };