A client that connects to a single stream. More...
#include <Client.h>
Public Types | |
using | callback_function_type = std::function< void(Buffer)> |
using | endpoint = boost::asio::ip::tcp::endpoint |
using | protocol_type = endpoint::protocol_type |
Public Member Functions | |
Client (boost::asio::io_context &io_context, const token_type &token, callback_function_type callback) | |
void | Connect () |
stream_id_type | GetStreamId () const |
void | Stop () |
~Client () | |
Private Member Functions | |
void | ReadData () |
void | Reconnect () |
Private Member Functions inherited from carla::profiler::LifetimeProfiled | |
LifetimeProfiled ()=default | |
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 | |
std::shared_ptr< BufferPool > | _buffer_pool |
callback_function_type | _callback |
boost::asio::deadline_timer | _connection_timer |
std::atomic_bool | _done {false} |
boost::asio::ip::tcp::socket | _socket |
boost::asio::io_context::strand | _strand |
const token_type | _token |
A client that connects to a single stream.
Definition at line 36 of file streaming/detail/tcp/Client.h.
using carla::streaming::detail::tcp::Client::callback_function_type = std::function<void (Buffer)> |
Definition at line 44 of file streaming/detail/tcp/Client.h.
using carla::streaming::detail::tcp::Client::endpoint = boost::asio::ip::tcp::endpoint |
Definition at line 42 of file streaming/detail/tcp/Client.h.
using carla::streaming::detail::tcp::Client::protocol_type = endpoint::protocol_type |
Definition at line 43 of file streaming/detail/tcp/Client.h.
carla::streaming::detail::tcp::Client::Client | ( | boost::asio::io_context & | io_context, |
const token_type & | token, | ||
callback_function_type | callback | ||
) |
Definition at line 68 of file streaming/detail/tcp/Client.cpp.
References _token, carla::streaming::detail::token_type::protocol_is_tcp(), carla::throw_exception(), and ~Client().
|
default |
void carla::streaming::detail::tcp::Client::Connect | ( | ) |
Definition at line 87 of file streaming/detail/tcp/Client.cpp.
References _done, _socket, _strand, _token, DEBUG_ASSERT, DEBUG_ASSERT_EQ, DEBUG_ONLY, carla::streaming::detail::token_type::get_stream_id(), carla::streaming::detail::token_type::is_valid(), carla::log_debug(), carla::log_info(), carla::streaming::detail::token_type::protocol_is_tcp(), ReadData(), Reconnect(), and carla::streaming::detail::token_type::to_tcp_endpoint().
Referenced by ReadData(), and Reconnect().
|
inline |
Definition at line 55 of file streaming/detail/tcp/Client.h.
References _token, carla::streaming::detail::token_type::get_stream_id(), ReadData(), Reconnect(), and Stop().
|
private |
Definition at line 166 of file streaming/detail/tcp/Client.cpp.
References _buffer_pool, _done, _socket, _strand, Connect(), DEBUG_ASSERT_EQ, DEBUG_ASSERT_NE, DEBUG_ONLY, and carla::log_debug().
Referenced by Connect(), and GetStreamId().
|
private |
Definition at line 156 of file streaming/detail/tcp/Client.cpp.
References _connection_timer, Connect(), and carla::time_duration::seconds().
Referenced by Connect(), and GetStreamId().
void carla::streaming::detail::tcp::Client::Stop | ( | void | ) |
Definition at line 145 of file streaming/detail/tcp/Client.cpp.
References _connection_timer, _done, _socket, and _strand.
Referenced by GetStreamId().
|
private |
Definition at line 77 of file streaming/detail/tcp/Client.h.
Referenced by ReadData().
|
private |
Definition at line 69 of file streaming/detail/tcp/Client.h.
|
private |
Definition at line 75 of file streaming/detail/tcp/Client.h.
Referenced by Reconnect(), and Stop().
|
private |
Definition at line 79 of file streaming/detail/tcp/Client.h.
Referenced by Connect(), ReadData(), and Stop().
|
private |
Definition at line 71 of file streaming/detail/tcp/Client.h.
Referenced by Connect(), ReadData(), and Stop().
|
private |
Definition at line 73 of file streaming/detail/tcp/Client.h.
Referenced by Connect(), ReadData(), and Stop().
|
private |
Definition at line 67 of file streaming/detail/tcp/Client.h.
Referenced by Client(), Connect(), and GetStreamId().