forked from boostorg/beast
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:
1 parent
de03a1a32d
commit
60c8a560bf
19 files changed
+254
-157
No files matched your search
@@ -161,21 +161,24 @@ public:
|
||||
|
||||
friend
|
||||
void
|
||||
teardown(websocket::teardown_tag,
|
||||
teardown(
|
||||
websocket::role_type role,
|
||||
fail_stream<NextLayer>& stream,
|
||||
boost::system::error_code& ec)
|
||||
boost::system::error_code& ec)
|
||||
{
|
||||
if(stream.pfc_->fail(ec))
|
||||
return;
|
||||
beast::websocket_helpers::call_teardown(stream.next_layer(), ec);
|
||||
using beast::websocket::teardown;
|
||||
teardown(role, stream.next_layer(), ec);
|
||||
}
|
||||
|
||||
template<class TeardownHandler>
|
||||
friend
|
||||
void
|
||||
async_teardown(websocket::teardown_tag,
|
||||
async_teardown(
|
||||
websocket::role_type role,
|
||||
fail_stream<NextLayer>& stream,
|
||||
TeardownHandler&& handler)
|
||||
TeardownHandler&& handler)
|
||||
{
|
||||
error_code ec;
|
||||
if(stream.pfc_->fail(ec))
|
||||
@@ -184,8 +187,9 @@ public:
|
||||
bind_handler(std::move(handler), ec));
|
||||
return;
|
||||
}
|
||||
beast::websocket_helpers::call_async_teardown(
|
||||
stream.next_layer(), std::forward<TeardownHandler>(handler));
|
||||
using beast::websocket::async_teardown;
|
||||
async_teardown(role, stream.next_layer(),
|
||||
std::forward<TeardownHandler>(handler));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -197,13 +197,15 @@ public:
|
||||
|
||||
friend
|
||||
void
|
||||
teardown(websocket::teardown_tag,
|
||||
teardown(
|
||||
websocket::role_type role,
|
||||
stream& s, boost::system::error_code& ec);
|
||||
|
||||
template<class TeardownHandler>
|
||||
friend
|
||||
void
|
||||
async_teardown(websocket::teardown_tag,
|
||||
async_teardown(
|
||||
websocket::role_type,
|
||||
stream& s, TeardownHandler&& handler);
|
||||
};
|
||||
|
||||
@@ -229,8 +231,10 @@ public:
|
||||
|
||||
inline
|
||||
void
|
||||
teardown(websocket::teardown_tag,
|
||||
pipe::stream& s, boost::system::error_code& ec)
|
||||
teardown(
|
||||
websocket::role_type,
|
||||
pipe::stream& s,
|
||||
boost::system::error_code& ec)
|
||||
{
|
||||
if(s.fc_)
|
||||
{
|
||||
@@ -247,7 +251,7 @@ teardown(websocket::teardown_tag,
|
||||
template<class TeardownHandler>
|
||||
inline
|
||||
void
|
||||
async_teardown(websocket::teardown_tag,
|
||||
async_teardown(websocket::role_type,
|
||||
pipe::stream& s, TeardownHandler&& handler)
|
||||
{
|
||||
error_code ec;
|
||||
|
||||
@@ -440,13 +440,13 @@ public:
|
||||
|
||||
friend
|
||||
void
|
||||
teardown(websocket::teardown_tag,
|
||||
teardown(websocket::role_type,
|
||||
stream& s, boost::system::error_code& ec);
|
||||
|
||||
template<class TeardownHandler>
|
||||
friend
|
||||
void
|
||||
async_teardown(websocket::teardown_tag,
|
||||
async_teardown(websocket::role_type role,
|
||||
stream& s, TeardownHandler&& handler);
|
||||
};
|
||||
|
||||
@@ -654,7 +654,7 @@ async_write_some(ConstBufferSequence const& buffers,
|
||||
|
||||
inline
|
||||
void
|
||||
teardown(websocket::teardown_tag,
|
||||
teardown(websocket::role_type,
|
||||
stream& s, boost::system::error_code& ec)
|
||||
{
|
||||
if(s.in_.fc)
|
||||
@@ -672,7 +672,7 @@ teardown(websocket::teardown_tag,
|
||||
template<class TeardownHandler>
|
||||
inline
|
||||
void
|
||||
async_teardown(websocket::teardown_tag,
|
||||
async_teardown(websocket::role_type,
|
||||
stream& s, TeardownHandler&& handler)
|
||||
{
|
||||
error_code ec;
|
||||
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
|
||||
friend
|
||||
void
|
||||
teardown(websocket::teardown_tag,
|
||||
teardown(websocket::role_type,
|
||||
string_iostream&,
|
||||
boost::system::error_code& ec)
|
||||
{
|
||||
@@ -160,7 +160,7 @@ public:
|
||||
template<class TeardownHandler>
|
||||
friend
|
||||
void
|
||||
async_teardown(websocket::teardown_tag,
|
||||
async_teardown(websocket::role_type,
|
||||
string_iostream& stream,
|
||||
TeardownHandler&& handler)
|
||||
{
|
||||
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
|
||||
friend
|
||||
void
|
||||
teardown(websocket::teardown_tag,
|
||||
teardown(websocket::role_type,
|
||||
string_istream&,
|
||||
boost::system::error_code& ec)
|
||||
{
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
template<class TeardownHandler>
|
||||
friend
|
||||
void
|
||||
async_teardown(websocket::teardown_tag,
|
||||
async_teardown(websocket::role_type,
|
||||
string_istream& stream,
|
||||
TeardownHandler&& handler)
|
||||
{
|
||||
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
|
||||
friend
|
||||
void
|
||||
teardown(websocket::teardown_tag,
|
||||
teardown(websocket::role_type,
|
||||
string_ostream&,
|
||||
boost::system::error_code& ec)
|
||||
{
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
template<class TeardownHandler>
|
||||
friend
|
||||
void
|
||||
async_teardown(websocket::teardown_tag,
|
||||
async_teardown(websocket::role_type,
|
||||
string_ostream& stream,
|
||||
TeardownHandler&& handler)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user