From 9cbed3e4e18a6c79935cf6ade55e8155ae02ee5c Mon Sep 17 00:00:00 2001 From: Asias He Date: Fri, 26 Jun 2015 09:37:58 +0800 Subject: [PATCH] streaming: Make stream_session::_handlers static It is used to register the streaming message handler once. We don't need it in every stream_session instance. The side effect is making stream_session copyable, which is needed in get_all_stream_sessions. --- streaming/stream_session.cc | 2 ++ streaming/stream_session.hh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/streaming/stream_session.cc b/streaming/stream_session.cc index 3a666b4738..3aa484e43e 100644 --- a/streaming/stream_session.cc +++ b/streaming/stream_session.cc @@ -86,6 +86,8 @@ void stream_session::init_messaging_service_handler() { }); } +distributed stream_session::_handlers; + future<> stream_session::start() { return _handlers.start().then([this] { return _handlers.invoke_on_all([this] (handler& h) { diff --git a/streaming/stream_session.hh b/streaming/stream_session.hh index e47662065d..08af2eb214 100644 --- a/streaming/stream_session.hh +++ b/streaming/stream_session.hh @@ -123,7 +123,7 @@ private: return make_ready_future<>(); } }; - distributed _handlers; + static distributed _handlers; void init_messaging_service_handler(); future<> start(); public: