|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
One connection. More...
Public Types | |
| using | Frame = std::shared_ptr<const std::vector<uint8_t>> |
Public Member Functions | |
| ConnectionState (asio::io_context &ctx, FramingPolicy framing, size_t max_message_size, size_t read_size) | |
| const Frame & | front () const |
| bool | has_queued () const |
| void | pop () |
| void | push (Frame frame) |
| The outbox is a vector with a head index, not a deque: it is touched only by the io thread, it rarely holds more than a frame or two, and a vector reuses its storage where a deque allocates a block per few elements, which on MSVC is one per frame. | |
| EndpointInfo | snapshot () const |
Public Attributes | |
| std::atomic< bool > | closed { false } |
| detail::StreamFramer | framer |
| EndpointInfo | info |
| bool | is_outbound {} |
| std::vector< Frame > | outbox |
| size_t | outbox_head {} |
| std::atomic< size_t > | pending_bytes { 0 } |
| std::vector< uint8_t > | read_buffer |
| std::unique_ptr< asio::steady_timer > | reconnect_timer |
| std::unique_ptr< asio::steady_timer > | settle_timer |
| Stream | socket |
| std::atomic< EndpointState > | state { EndpointState::CLOSED } |
| bool | writing {} |
One connection.
info is fixed once the connection is published, and state, which the io thread writes and any thread reads, is atomic. The socket, the read buffer and the framer belong to the io thread. Handlers hold a shared_ptr, so a connection that close_endpoint removes stays valid until the handlers that still hold it return.
Definition at line 226 of file StreamBackend.hpp.