Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:01

0001 //
0002 // ssl/detail/shutdown_op.hpp
0003 // ~~~~~~~~~~~~~~~~~~~~~~~~~~
0004 //
0005 // Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 //
0010 
0011 #ifndef BOOST_ASIO_SSL_DETAIL_SHUTDOWN_OP_HPP
0012 #define BOOST_ASIO_SSL_DETAIL_SHUTDOWN_OP_HPP
0013 
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
0017 
0018 #include <boost/asio/detail/config.hpp>
0019 
0020 #include <boost/asio/ssl/detail/engine.hpp>
0021 
0022 #include <boost/asio/detail/push_options.hpp>
0023 
0024 namespace boost {
0025 namespace asio {
0026 namespace ssl {
0027 namespace detail {
0028 
0029 class shutdown_op
0030 {
0031 public:
0032   static constexpr const char* tracking_name()
0033   {
0034     return "ssl::stream<>::async_shutdown";
0035   }
0036 
0037   engine::want operator()(engine& eng,
0038       boost::system::error_code& ec,
0039       std::size_t& bytes_transferred) const
0040   {
0041     bytes_transferred = 0;
0042     return eng.shutdown(ec);
0043   }
0044 
0045   template <typename Handler>
0046   void call_handler(Handler& handler,
0047       const boost::system::error_code& ec,
0048       const std::size_t&) const
0049   {
0050     if (ec == boost::asio::error::eof)
0051     {
0052       // The engine only generates an eof when the shutdown notification has
0053       // been received from the peer. This indicates that the shutdown has
0054       // completed successfully, and thus need not be passed on to the handler.
0055       static_cast<Handler&&>(handler)(boost::system::error_code());
0056     }
0057     else
0058     {
0059       static_cast<Handler&&>(handler)(ec);
0060     }
0061   }
0062 };
0063 
0064 } // namespace detail
0065 } // namespace ssl
0066 } // namespace asio
0067 } // namespace boost
0068 
0069 #include <boost/asio/detail/pop_options.hpp>
0070 
0071 #endif // BOOST_ASIO_SSL_DETAIL_SHUTDOWN_OP_HPP