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");
void ClearSessions() final
AtomicSharedPtr< Session > _session
StreamStateBase(const token_type &token)
MultiStreamState(const token_type &token)
const token_type & token() const
This file contains definitions of common data structures used in traffic manager. ...
static void log_debug(Args &&...)
void ConnectSession(std::shared_ptr< Session > session) final
#define DEBUG_ASSERT(predicate)
Serializes a stream endpoint.
A stream state that can hold any number of sessions.
void DisconnectSession(std::shared_ptr< Session > session) final
void Write(Buffers... buffers)
bool AreClientsListening()
A very simple atomic shared ptr with release-acquire memory order.
std::vector< std::shared_ptr< Session > > _sessions
static auto MakeMessage(Buffers... buffers)
Shared state among all the copies of a stream.