Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:38:19

0001 //
0002 // Copyright (c) 2025 Ivica Siladic, Bruno Iljazovic, Korina Simicevic
0003 //
0004 // Distributed under the Boost Software License, Version 1.0.
0005 // (See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 
0008 #ifndef BOOST_MQTT5_SHUTDOWN_HPP
0009 #define BOOST_MQTT5_SHUTDOWN_HPP
0010 
0011 #include <boost/asio/basic_stream_socket.hpp>
0012 
0013 namespace boost::mqtt5::detail {
0014 
0015 template <typename Stream, typename ShutdownHandler>
0016 void async_shutdown(Stream& /* stream */, ShutdownHandler&& /* handler */) {
0017 /*
0018     If you are trying to use beast::websocket::stream and/or OpenSSL
0019     and this goes off, you need to add an include for one of these
0020         * <boost/mqtt5/websocket.hpp>
0021         * <boost/mqtt5/ssl.hpp>
0022         * <boost/mqtt5/websocket_ssl.hpp>
0023 
0024     If you are trying to use mqtt_client with user-defined stream type, you must
0025     provide an overload of async_shutdown that is discoverable via
0026     argument-dependent lookup (ADL).
0027 */
0028     static_assert(sizeof(Stream) == -1,
0029         "Unknown Stream type in async_shutdown.");
0030 }
0031 
0032 template <typename P, typename E, typename ShutdownHandler>
0033 void async_shutdown(
0034     asio::basic_stream_socket<P, E>& socket, ShutdownHandler&& handler
0035 ) {
0036     boost::system::error_code ec;
0037     socket.shutdown(asio::socket_base::shutdown_both, ec);
0038     return std::move(handler)(ec);
0039 }
0040 
0041 } // end namespace boost::mqtt5::detail
0042 
0043 #endif // !BOOST_MQTT5_SHUTDOWN_HPP