10 #include <boost/asio/post.hpp> 20 : _io_context(io_context),
21 _acceptor(_io_context,
std::move(ep)),
43 using boost::system::error_code;
45 auto session = std::make_shared<Primary>(
_io_context, timeout, *
this);
46 auto self = shared_from_this();
48 auto handle_query = [on_opened, on_closed, on_response, session,
self](
const error_code &ec) {
50 session->Open(std::move(on_opened), std::move(on_closed), std::move(on_response));
52 log_error(
"Secondary server:", ec.message());
56 _acceptor.async_accept(session->_socket, [=](error_code ec) {
58 boost::asio::post(_io_context, [=]() { handle_query(ec); });
59 OpenSession(timeout, on_opened, on_closed, on_response);
std::function< void(std::shared_ptr< Primary >, carla::Buffer)> callback_function_type_response
void OpenSession(time_duration timeout, callback_function_type on_session_opened, callback_function_type on_session_closed, callback_function_type_response on_response)
boost::asio::io_context & _io_context
std::function< void(std::shared_ptr< Primary >)> callback_function_type
boost::asio::ip::tcp::acceptor _acceptor
static void log_error(Args &&... args)
This file contains definitions of common data structures used in traffic manager. ...
boost::asio::ip::tcp::endpoint endpoint
Listener(boost::asio::io_context &io_context, endpoint ep)
Positive time duration up to milliseconds resolution.