Files
boost_beast/include/boost/beast/websocket/impl/ssl.hpp

60 lines
1.3 KiB
C++
Raw Normal View History

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
#ifndef BOOST_BEAST_WEBSOCKET_IMPL_SSL_HPP
#define BOOST_BEAST_WEBSOCKET_IMPL_SSL_HPP
2017-07-20 08:01:46 -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 {
/*
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
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
teardown(
role_type,
net::ssl::stream<AsyncStream>& stream,
error_code& ec)
2017-07-20 08:01:46 -07:00
{
stream.shutdown(ec);
}
template<
class AsyncStream,
class TeardownHandler>
2017-07-20 08:01:46 -07:00
void
async_teardown(
role_type,
net::ssl::stream<AsyncStream>& stream,
TeardownHandler&& handler)
2017-07-20 08:01:46 -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