2017-07-20 08:01:46 -07:00
|
|
|
//
|
2019-02-21 07:00:31 -08:00
|
|
|
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
2017-07-20 08:01:46 -07:00
|
|
|
//
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
//
|
2017-07-20 13:40:34 -07:00
|
|
|
// Official repository: https://github.com/boostorg/beast
|
|
|
|
//
|
2017-07-20 08:01:46 -07:00
|
|
|
|
2019-01-19 07:24:00 -08:00
|
|
|
#ifndef BOOST_BEAST_WEBSOCKET_IMPL_SSL_HPP
|
|
|
|
#define BOOST_BEAST_WEBSOCKET_IMPL_SSL_HPP
|
2017-07-20 08:01:46 -07:00
|
|
|
|
2017-06-20 19:03:39 -07:00
|
|
|
#include <utility>
|
2017-07-20 08:01:46 -07:00
|
|
|
|
2017-07-20 13:40:34 -07:00
|
|
|
namespace boost {
|
2017-07-20 08:01:46 -07:00
|
|
|
namespace beast {
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
2019-02-23 06:34:52 -08:00
|
|
|
See
|
|
|
|
http://stackoverflow.com/questions/32046034/what-is-the-proper-way-to-securely-disconnect-an-asio-ssl-socket/32054476#32054476
|
2017-07-20 08:01:46 -07:00
|
|
|
|
2019-02-23 06:34:52 -08:00
|
|
|
Behavior of ssl::stream regarding close_notify
|
2017-07-20 08:01:46 -07:00
|
|
|
|
|
|
|
If the remote host calls async_shutdown then the
|
|
|
|
local host's async_read will complete with eof.
|
|
|
|
|
|
|
|
If both hosts call async_shutdown then the calls
|
|
|
|
to async_shutdown will complete with eof.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
template<class AsyncStream>
|
|
|
|
void
|
2017-08-04 13:31:24 -07:00
|
|
|
teardown(
|
|
|
|
role_type,
|
2018-11-30 14:58:38 -08:00
|
|
|
net::ssl::stream<AsyncStream>& stream,
|
2017-08-04 13:31:24 -07:00
|
|
|
error_code& ec)
|
2017-07-20 08:01:46 -07:00
|
|
|
{
|
|
|
|
stream.shutdown(ec);
|
|
|
|
}
|
|
|
|
|
2017-08-04 13:31:24 -07:00
|
|
|
template<
|
|
|
|
class AsyncStream,
|
|
|
|
class TeardownHandler>
|
2017-07-20 08:01:46 -07:00
|
|
|
void
|
2017-08-04 13:31:24 -07:00
|
|
|
async_teardown(
|
|
|
|
role_type,
|
2018-11-30 14:58:38 -08:00
|
|
|
net::ssl::stream<AsyncStream>& stream,
|
2017-08-04 13:31:24 -07:00
|
|
|
TeardownHandler&& handler)
|
2017-07-20 08:01:46 -07:00
|
|
|
{
|
2017-08-04 13:31:24 -07:00
|
|
|
stream.async_shutdown(
|
|
|
|
std::forward<TeardownHandler>(handler));
|
2017-07-20 08:01:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
} // beast
|
2017-07-20 13:40:34 -07:00
|
|
|
} // boost
|
2017-07-20 08:01:46 -07:00
|
|
|
|
|
|
|
#endif
|