35 template <
typename... Buffers>
36 void Write(Buffers... buffers) {
39 if (session !=
nullptr) {
41 session->Write(std::move(message));
42 log_debug(
"sensor ", session->get_stream_id(),
" data sent");
49 std::lock_guard<std::mutex> lock(
_mutex);
55 log_debug(
"sensor ", s->get_stream_id(),
" data sent ");
83 std::lock_guard<std::mutex> lock(
_mutex);
84 _sessions.emplace_back(std::move(session));
96 std::lock_guard<std::mutex> lock(
_mutex);
97 log_debug(
"Calling DisconnectSession for ", session->get_stream_id());
120 std::lock_guard<std::mutex> lock(
_mutex);
129 log_debug(
"Disconnecting all multistream sessions");
#define DEBUG_ASSERT(predicate)
A very simple atomic shared ptr with release-acquire memory order.
A stream state that can hold any number of sessions.
void ClearSessions() final
void DisconnectSession(std::shared_ptr< Session > session) final
std::vector< std::shared_ptr< Session > > _sessions
AtomicSharedPtr< Session > _session
bool AreClientsListening()
void ConnectSession(std::shared_ptr< Session > session) final
void Write(Buffers... buffers)
MultiStreamState(const token_type &token)
Shared state among all the copies of a stream.
StreamStateBase(const token_type &token)
const token_type & token() const
static auto MakeMessage(Buffers... buffers)
Serializes a stream endpoint.
This file contains definitions of common data structures used in traffic manager.
static void log_debug(Args &&... args)