|
CARLA
|
#include <secondary.h>
Inheritance diagram for carla::multigpu::Secondary:Public Types | |
| using | endpoint = boost::asio::ip::tcp::endpoint |
| using | protocol_type = endpoint::protocol_type |
Public Member Functions | |
| void | AsyncRun (size_t worker_threads) |
| void | Connect () |
| SecondaryCommands & | GetCommander () |
| bool | IsConnected () const |
| Whether the connection to the primary is up: false before the first connect, after a read fails (the primary is gone; this session is not resumed) and after Stop(). | |
| Secondary (boost::asio::ip::tcp::endpoint ep, SecondaryCommands::callback_type callback) | |
| Secondary (std::string ip, uint16_t port, SecondaryCommands::callback_type callback) | |
| void | Stop () |
| Blocks until the io threads have exited. | |
| void | Write (Buffer buffer) |
| void | Write (std::shared_ptr< const carla::streaming::detail::tcp::Message > message) |
| void | Write (std::string text) |
| ~Secondary () | |
Static Public Member Functions | |
| template<typename... Buffers> | |
| static auto | MakeMessage (Buffers... buffers) |
Private Types | |
| using | message_type = std::shared_ptr< const carla::streaming::detail::tcp::Message > |
Private Member Functions | |
| void | Disconnect () |
| Marks the connection lost and closes the socket. Strand only. | |
| void | ReadData () |
| void | Reconnect () |
| void | WriteNext () |
| Starts writing the front of the write queue. Strand only. | |
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 |
| SecondaryCommands | _commander |
| std::atomic_bool | _connected {false} |
| boost::asio::steady_timer | _connection_timer |
| std::atomic_bool | _done {false} |
| boost::asio::ip::tcp::endpoint | _endpoint |
| bool | _is_writing = false |
| ThreadPool | _pool |
| std::once_flag | _run_flag |
| boost::asio::ip::tcp::socket | _socket |
| boost::asio::io_context::strand | _strand |
| uint64_t | _write_generation = 0u |
| Strand only: bumped by Disconnect(), so that the completion of a write it dropped leaves the queue alone. | |
| std::deque< message_type > | _write_queue |
| Strand only: messages waiting to be written, oldest first, with a single write in flight so that two replies never interleave. | |
Definition at line 37 of file secondary.h.
| using carla::multigpu::Secondary::endpoint = boost::asio::ip::tcp::endpoint |
Definition at line 43 of file secondary.h.
|
private |
Definition at line 83 of file secondary.h.
| using carla::multigpu::Secondary::protocol_type = endpoint::protocol_type |
Definition at line 44 of file secondary.h.
| carla::multigpu::Secondary::Secondary | ( | boost::asio::ip::tcp::endpoint | ep, |
| SecondaryCommands::callback_type | callback | ||
| ) |
Definition at line 30 of file secondary.cpp.
References _commander, and carla::multigpu::SecondaryCommands::set_callback().
| carla::multigpu::Secondary::Secondary | ( | std::string | ip, |
| uint16_t | port, | ||
| SecondaryCommands::callback_type | callback | ||
| ) |
Definition at line 44 of file secondary.cpp.
References _commander, _endpoint, and carla::multigpu::SecondaryCommands::set_callback().
| carla::multigpu::Secondary::~Secondary | ( | ) |
Definition at line 59 of file secondary.cpp.
References _pool, and carla::ThreadPool::Stop().
| void carla::multigpu::Secondary::AsyncRun | ( | size_t | worker_threads | ) |
Definition at line 134 of file secondary.cpp.
Referenced by Connect().
| void carla::multigpu::Secondary::Connect | ( | ) |
Definition at line 63 of file secondary.cpp.
References _commander, _run_flag, _strand, AsyncRun(), carla::multigpu::EnableKeepAlive(), carla::log_info(), and carla::multigpu::SecondaryCommands::set_secondary().
|
private |
Marks the connection lost and closes the socket. Strand only.
Definition at line 198 of file secondary.cpp.
|
inline |
Definition at line 69 of file secondary.h.
References _commander.
|
inline |
Whether the connection to the primary is up: false before the first connect, after a read fails (the primary is gone; this session is not resumed) and after Stop().
Any thread.
Definition at line 65 of file secondary.h.
References _connected.
|
inlinestatic |
Definition at line 74 of file secondary.h.
|
private |
Definition at line 207 of file secondary.cpp.
References DEBUG_ASSERT_EQ, DEBUG_ASSERT_NE, DEBUG_ONLY, carla::multigpu::kMaxMultiGpuMessageBytes, and carla::log_error().
|
private |
Definition at line 122 of file secondary.cpp.
References carla::time_duration::seconds().
| void carla::multigpu::Secondary::Stop | ( | ) |
Blocks until the io threads have exited.
Must not be called from one of them (i.e. from a command callback).
Definition at line 111 of file secondary.cpp.
| void carla::multigpu::Secondary::Write | ( | Buffer | buffer | ) |
Definition at line 189 of file secondary.cpp.
References carla::BufferView::CreateFrom().
| void carla::multigpu::Secondary::Write | ( | std::shared_ptr< const carla::streaming::detail::tcp::Message > | message | ) |
Definition at line 138 of file secondary.cpp.
References DEBUG_ASSERT.
| void carla::multigpu::Secondary::Write | ( | std::string | text | ) |
Definition at line 193 of file secondary.cpp.
|
private |
Starts writing the front of the write queue. Strand only.
Definition at line 155 of file secondary.cpp.
References carla::log_error().
|
private |
Definition at line 100 of file secondary.h.
|
private |
Definition at line 111 of file secondary.h.
Referenced by Connect(), GetCommander(), Secondary(), and Secondary().
|
private |
Definition at line 102 of file secondary.h.
Referenced by IsConnected().
|
private |
Definition at line 99 of file secondary.h.
|
private |
Definition at line 101 of file secondary.h.
|
private |
Definition at line 97 of file secondary.h.
Referenced by Secondary().
|
private |
Definition at line 106 of file secondary.h.
|
private |
Definition at line 95 of file secondary.h.
Referenced by ~Secondary().
|
private |
Definition at line 110 of file secondary.h.
Referenced by Connect().
|
private |
Definition at line 96 of file secondary.h.
|
private |
Definition at line 98 of file secondary.h.
Referenced by Connect().
|
private |
Strand only: bumped by Disconnect(), so that the completion of a write it dropped leaves the queue alone.
Definition at line 109 of file secondary.h.
|
private |
Strand only: messages waiting to be written, oldest first, with a single write in flight so that two replies never interleave.
Definition at line 105 of file secondary.h.