diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-03-21 14:30:09 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-06-19 10:43:35 +0200 |
commit | 76e7f0f79c908bf7d0a447ea643dbcdde8f064d2 (patch) | |
tree | 214230901ec43d923e1696c54005a123278df086 /src/ManagementServer.h | |
parent | 0ac177534620caa13864f9bfcd804004e3e538fd (diff) | |
download | dabmux-76e7f0f79c908bf7d0a447ea643dbcdde8f064d2.tar.gz dabmux-76e7f0f79c908bf7d0a447ea643dbcdde8f064d2.tar.bz2 dabmux-76e7f0f79c908bf7d0a447ea643dbcdde8f064d2.zip |
Start big refactoring
Multiplexer in separate object
Replace pointers by shared_ptr
Switch to C++11
Diffstat (limited to 'src/ManagementServer.h')
-rw-r--r-- | src/ManagementServer.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/ManagementServer.h b/src/ManagementServer.h index 273f576..c71f6d2 100644 --- a/src/ManagementServer.h +++ b/src/ManagementServer.h @@ -317,21 +317,9 @@ class ManagementServer { public: ManagementServer() : - m_listenport(0), m_running(false), m_fault(false), - m_pending(false) - { } - - ManagementServer(int listen_port) : - m_listenport(listen_port), - m_running(false), - m_fault(false), - m_thread(&ManagementServer::serverThread, this), - m_pending(false) - { - m_sock = 0; - } + m_pending(false) { } ~ManagementServer() { @@ -340,10 +328,20 @@ class ManagementServer m_pending = false; if (m_sock) { close(m_sock); + m_thread.interrupt(); } m_thread.join(); } + void open(int listenport) + { + m_listenport = listenport; + if (m_listenport > 0) { + m_sock = 0; + m_thread = boost::thread(&ManagementServer::serverThread, this); + } + } + /* Un-/Register a statistics data source */ void registerInput(InputStat* is); void unregisterInput(std::string id); @@ -420,7 +418,9 @@ class ManagementServer boost::property_tree::ptree m_pt; }; -extern ManagementServer* mgmt_server; +// If necessary construct the management server singleton and return +// a reference to it +ManagementServer& get_mgmt_server(); #endif |