#include <listener.h>
Public Types | |
using | callback_function_type = std::function< void(std::shared_ptr< Primary >)> |
using | callback_function_type_response = std::function< void(std::shared_ptr< Primary >, carla::Buffer)> |
using | endpoint = boost::asio::ip::tcp::endpoint |
using | protocol_type = endpoint::protocol_type |
using | Session = std::shared_ptr< Primary > |
Public Member Functions | |
endpoint | GetLocalEndpoint () const |
void | Listen (callback_function_type on_session_opened, callback_function_type on_session_closed, callback_function_type_response on_response) |
Start listening for connections. More... | |
Listener (boost::asio::io_context &io_context, endpoint ep) | |
void | SetTimeout (time_duration timeout) |
Set session time-out. More... | |
void | Stop () |
~Listener () | |
Private Member Functions | |
void | OpenSession (time_duration timeout, callback_function_type on_session_opened, callback_function_type on_session_closed, callback_function_type_response on_response) |
Private Member Functions inherited from carla::NonCopyable | |
NonCopyable ()=default | |
NonCopyable (const NonCopyable &)=delete | |
NonCopyable (NonCopyable &&)=delete | |
NonCopyable & | operator= (const NonCopyable &)=delete |
NonCopyable & | operator= (NonCopyable &&)=delete |
Private Attributes | |
boost::asio::ip::tcp::acceptor | _acceptor |
boost::asio::io_context & | _io_context |
std::atomic< time_duration > | _timeout |
Definition at line 26 of file listener.h.
using carla::multigpu::Listener::callback_function_type = std::function<void(std::shared_ptr<Primary>)> |
Definition at line 32 of file listener.h.
using carla::multigpu::Listener::callback_function_type_response = std::function<void(std::shared_ptr<Primary>, carla::Buffer)> |
Definition at line 33 of file listener.h.
using carla::multigpu::Listener::endpoint = boost::asio::ip::tcp::endpoint |
Definition at line 29 of file listener.h.
using carla::multigpu::Listener::protocol_type = endpoint::protocol_type |
Definition at line 30 of file listener.h.
using carla::multigpu::Listener::Session = std::shared_ptr<Primary> |
Definition at line 31 of file listener.h.
|
explicit |
Definition at line 19 of file listener.cpp.
References _acceptor.
carla::multigpu::Listener::~Listener | ( | ) |
Definition at line 26 of file listener.cpp.
References Stop().
|
inline |
Definition at line 38 of file listener.h.
References _acceptor.
|
inline |
Start listening for connections.
On each new connection, on_session_opened is called, and on_session_closed when the session is closed, also on_response is called when an answer is received.
Definition at line 51 of file listener.h.
References _io_context, _timeout, OpenSession(), and Stop().
|
private |
Definition at line 37 of file listener.cpp.
References _acceptor, _io_context, and carla::log_error().
Referenced by Listen().
|
inline |
Set session time-out.
Applies only to newly created sessions. By default the time-out is set to 10 seconds.
Definition at line 44 of file listener.h.
References _timeout.
void carla::multigpu::Listener::Stop | ( | void | ) |
Definition at line 30 of file listener.cpp.
References _acceptor, and _io_context.
Referenced by Listen(), and ~Listener().
|
private |
Definition at line 74 of file listener.h.
Referenced by GetLocalEndpoint(), Listener(), OpenSession(), and Stop().
|
private |
Definition at line 73 of file listener.h.
Referenced by Listen(), OpenSession(), and Stop().
|
private |
Definition at line 75 of file listener.h.
Referenced by Listen(), and SetTimeout().