void tcp_adapter_proxy::web_socket_close_and_stop()

in src/TcpAdapterProxy.cpp [368:398]


    void tcp_adapter_proxy::web_socket_close_and_stop(tcp_adapter_context &tac)
    {
        if (tac.wss)
        {
            if (tac.wss->is_open())
            {
                tac.wss->async_teardown(boost::beast::role_type::client, [&tac, this](boost::system::error_code const &ec)
                {
                    if (ec)
                    {
                        BOOST_LOG_SEV(this->log, error) << "Teardown of web socket connection not successful: " << ec.message();
                    }
                    if (tac.wss->lowest_layer().is_open())
                    {
                        tac.wss->lowest_layer().close();
                    }
                    tac.io_ctx.stop();
                });
            }
            else if (tac.wss->lowest_layer().is_open())
            {
                tac.wss->lowest_layer().close();
                tac.io_ctx.stop();
            }
            else
            {
                tac.io_ctx.stop();
            }
        }
        tac.io_ctx.stop();
    }