diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bf9407d..3b6cc60c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ * Documentation tidying * is_invocable works with move-only types + +WebSocket + * websocket::stream tidying +* Add rd_close_ to websocket stream state -------------------------------------------------------------------------------- diff --git a/include/beast/websocket/impl/read.ipp b/include/beast/websocket/impl/read.ipp index ec27dba4..403bc646 100644 --- a/include/beast/websocket/impl/read.ipp +++ b/include/beast/websocket/impl/read.ipp @@ -472,6 +472,8 @@ operator()(error_code ec, } BOOST_ASSERT(d.fh.op == detail::opcode::close); { + BOOST_ASSERT(! d.ws.rd_close_); + d.ws.rd_close_ = true; detail::read(d.ws.cr_, d.fb.data(), code); if(code != close_code::none) { @@ -822,6 +824,8 @@ read_frame(DynamicBuffer& dynabuf, error_code& ec) } BOOST_ASSERT(fh.op == detail::opcode::close); { + BOOST_ASSERT(! rd_close_); + rd_close_ = true; detail::read(cr_, fb.data(), code); if(code != close_code::none) goto do_close; diff --git a/include/beast/websocket/impl/stream.ipp b/include/beast/websocket/impl/stream.ipp index 1b064912..03a00258 100644 --- a/include/beast/websocket/impl/stream.ipp +++ b/include/beast/websocket/impl/stream.ipp @@ -79,6 +79,7 @@ open(role_type role) role_ = role; failed_ = false; rd_.cont = false; + rd_close_ = false; wr_close_ = false; wr_block_ = nullptr; // should be nullptr on close anyway ping_data_ = nullptr; // should be nullptr on close anyway @@ -132,6 +133,7 @@ reset() { failed_ = false; rd_.cont = false; + rd_close_ = false; wr_close_ = false; wr_.cont = false; wr_block_ = nullptr; // should be nullptr on close anyway diff --git a/include/beast/websocket/stream.hpp b/include/beast/websocket/stream.hpp index 7d59ca49..680b9a3f 100644 --- a/include/beast/websocket/stream.hpp +++ b/include/beast/websocket/stream.hpp @@ -213,6 +213,7 @@ class stream role_type role_; // server or client bool failed_; // the connection failed + bool rd_close_; // read close frame bool wr_close_; // sent close frame op* wr_block_; // op currenly writing