Add teardown_role for correct TIME_WAIT behavior (API Change):

* teardown_tag is replaced with teardown_role, a client/server
  flag used to determine whether the shutdown is performed
  before or after reading the EOF. This is in accordance with
  RFC6455 7.1.1:

  https://tools.ietf.org/html/rfc6455#section-7.1.1

Actions Required:

* Modify signatures of teardown and async_teardown to use
  teardown_role instead of teardown_tag

* Change calls to teardown and async_teardown to pass the
  correct role: client or server depending on context.
This commit is contained in:
Vinnie Falco
2017-08-04 19:02:13 -07:00
parent de03a1a32d
commit 60c8a560bf
19 changed files with 254 additions and 157 deletions
+11 -8
View File
@@ -294,14 +294,14 @@ public:
template<class SyncStream>
friend
void
teardown(boost::beast::websocket::teardown_tag,
teardown(boost::beast::websocket::role_type,
ssl_stream<SyncStream>& stream,
boost::system::error_code& ec);
template<class AsyncStream, class TeardownHandler>
friend
void
async_teardown(boost::beast::websocket::teardown_tag,
async_teardown(boost::beast::websocket::role_type,
ssl_stream<AsyncStream>& stream, TeardownHandler&& handler);
};
@@ -312,24 +312,27 @@ public:
template<class SyncStream>
inline
void
teardown(boost::beast::websocket::teardown_tag,
teardown(
boost::beast::websocket::role_type role,
ssl_stream<SyncStream>& stream,
boost::system::error_code& ec)
boost::system::error_code& ec)
{
// Just forward it to the wrapped ssl::stream
using boost::beast::websocket::teardown;
teardown(boost::beast::websocket::teardown_tag{}, *stream.p_, ec);
teardown(role, *stream.p_, ec);
}
template<class AsyncStream, class TeardownHandler>
inline
void
async_teardown(boost::beast::websocket::teardown_tag,
ssl_stream<AsyncStream>& stream, TeardownHandler&& handler)
async_teardown(
boost::beast::websocket::role_type role,
ssl_stream<AsyncStream>& stream,
TeardownHandler&& handler)
{
// Just forward it to the wrapped ssl::stream
using boost::beast::websocket::async_teardown;
async_teardown(boost::beast::websocket::teardown_tag{},
async_teardown(role,
*stream.p_, std::forward<TeardownHandler>(handler));
}