Fix ssl_stream teardown

This commit is contained in:
Vinnie Falco
2019-03-27 09:13:32 -07:00
parent 2c141cd4ad
commit ed9d861545
2 changed files with 38 additions and 30 deletions

View File

@@ -1,3 +1,9 @@
Version 240:
* Fix ssl_stream teardown
--------------------------------------------------------------------------------
Version 239: Version 239:
* More split compilation in HTTP * More split compilation in HTTP

View File

@@ -644,37 +644,39 @@ public:
return p_->async_read_some(buffers, return p_->async_read_some(buffers,
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
} }
};
// These hooks are used to inform boost::beast::websocket::stream on // These hooks are used to inform boost::beast::websocket::stream on
// how to tear down the connection as part of the WebSocket // how to tear down the connection as part of the WebSocket
// protocol specifications // protocol specifications
#if ! BOOST_BEAST_DOXYGEN #if ! BOOST_BEAST_DOXYGEN
template<class SyncStream> template<class SyncStream>
void friend
teardown( void
teardown(
boost::beast::role_type role, boost::beast::role_type role,
ssl_stream<SyncStream>& stream, ssl_stream<SyncStream>& stream,
boost::system::error_code& ec) boost::system::error_code& ec)
{ {
// Just forward it to the wrapped stream // Just forward it to the underlying ssl::stream
using boost::beast::websocket::teardown; using boost::beast::websocket::teardown;
teardown(role, stream.next_layer(), ec); teardown(role, *stream.p_, ec);
} }
template<class AsyncStream, class TeardownHandler> template<class AsyncStream, class TeardownHandler>
void friend
async_teardown( void
async_teardown(
boost::beast::role_type role, boost::beast::role_type role,
ssl_stream<AsyncStream>& stream, ssl_stream<AsyncStream>& stream,
TeardownHandler&& handler) TeardownHandler&& handler)
{ {
// Just forward it to the wrapped stream // Just forward it to the underlying ssl::stream
using boost::beast::websocket::async_teardown; using boost::beast::websocket::async_teardown;
async_teardown(role, async_teardown(role, *stream.p_,
stream.next_layer(), std::forward<TeardownHandler>(handler)); std::forward<TeardownHandler>(handler));
} }
#endif #endif
};
} // beast } // beast
} // boost } // boost