diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d8ecd6a..2bff01af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ Version 171: * Add handler_ptr::has_value +* Remove spurious assert -------------------------------------------------------------------------------- diff --git a/include/boost/beast/websocket/impl/close.ipp b/include/boost/beast/websocket/impl/close.ipp index ef078ddd..62ddffa2 100644 --- a/include/boost/beast/websocket/impl/close.ipp +++ b/include/boost/beast/websocket/impl/close.ipp @@ -138,14 +138,8 @@ operator()( d.cont = cont; BOOST_ASIO_CORO_REENTER(*this) { - // Maybe suspend - if(d.ws.wr_block_.try_lock(this)) - { - // Make sure the stream is open - if(! d.ws.check_open(ec)) - goto upcall; - } - else + // Attempt to acquire write block + if(! d.ws.wr_block_.try_lock(this)) { // Suspend BOOST_ASIO_CORO_YIELD @@ -159,12 +153,12 @@ operator()( boost::asio::post( d.ws.get_executor(), std::move(*this)); BOOST_ASSERT(d.ws.wr_block_.is_locked(this)); - - // Make sure the stream is open - if(! d.ws.check_open(ec)) - goto upcall; } + // Make sure the stream is open + if(! d.ws.check_open(ec)) + goto upcall; + // Can't call close twice BOOST_ASSERT(! d.ws.wr_close_); diff --git a/include/boost/beast/websocket/impl/read.ipp b/include/boost/beast/websocket/impl/read.ipp index 73ea62d1..9e8e0c47 100644 --- a/include/boost/beast/websocket/impl/read.ipp +++ b/include/boost/beast/websocket/impl/read.ipp @@ -626,12 +626,8 @@ operator()( goto upcall; close: - if(ws_.wr_block_.try_lock(this)) - { - // Make sure the stream is open - BOOST_ASSERT(ws_.status_ == status::open); - } - else + // Try to acquire the write block + if(! ws_.wr_block_.try_lock(this)) { // Suspend BOOST_ASIO_CORO_YIELD