diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-04-01 13:24:56 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-04-01 13:24:56 +0200 |
commit | ee0db2ebbc3e0e9d6a50e8ab3fd108d903afed2a (patch) | |
tree | c8b983b5a60ccdd77bb3ba6c2337cd74dba85391 /src/ManagementServer.cpp | |
parent | 8a855958f7be056220f1ce2c32b8090871528f23 (diff) | |
download | dabmux-ee0db2ebbc3e0e9d6a50e8ab3fd108d903afed2a.tar.gz dabmux-ee0db2ebbc3e0e9d6a50e8ab3fd108d903afed2a.tar.bz2 dabmux-ee0db2ebbc3e0e9d6a50e8ab3fd108d903afed2a.zip |
Remove incomplete setptree ManagementServer command
Diffstat (limited to 'src/ManagementServer.cpp')
-rw-r--r-- | src/ManagementServer.cpp | 70 |
1 files changed, 1 insertions, 69 deletions
diff --git a/src/ManagementServer.cpp b/src/ManagementServer.cpp index 7194689..dd4da89 100644 --- a/src/ManagementServer.cpp +++ b/src/ManagementServer.cpp @@ -2,7 +2,7 @@ Copyright (C) 2009 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2014, 2015 + Copyright (C) 2016 Matthias P. Braendli, matthias.braendli@mpb.li http://www.opendigitalradio.org @@ -218,47 +218,6 @@ void ManagementServer::serverThread() m_fault = true; } -bool ManagementServer::handle_setptree( - zmq::message_t& zmq_message, std::stringstream& answer) -{ - try { - if (zmq_message.more()) { - zmq::message_t zmq_new_ptree; - m_zmq_sock.recv(&zmq_new_ptree); - std::string new_ptree( - (char*)zmq_new_ptree.data(), zmq_new_ptree.size() - ); - - etiLog.level(info) << "Received ptree " << new_ptree; - -#if (BOOST_VERSION / 100000 == 1) && (BOOST_VERSION / 100 % 1000 >= 55) - boost::unique_lock<boost::mutex> lock(m_configmutex); - m_pt.clear(); - - std::stringstream json_stream; - json_stream << new_ptree; - boost::property_tree::json_parser::read_json(json_stream, m_pt); - - m_retrieve_pending = true; - answer << "OK"; - - return true; -#else -# warning "Boost version too old, ptree loading through ManagementServer disabled" -#endif - } - else { - etiLog.level(error) << - "MGMT: setptree command is missing data."; - } - } - catch (std::exception& e) { - etiLog.level(error) << - "MGMT: setptree error." << e.what(); - } - return false; -} - void ManagementServer::handle_message(zmq::message_t& zmq_message) { std::stringstream answer; @@ -288,16 +247,8 @@ void ManagementServer::handle_message(zmq::message_t& zmq_message) else if (data == "state") { answer << getStateJSON(); } - else if (data == "setptree") { - handle_setptree(zmq_message, answer); - } else if (data == "getptree") { boost::unique_lock<boost::mutex> lock(m_configmutex); - m_pending = true; - - while (m_pending && !m_retrieve_pending) { - m_condition.wait(lock); - } boost::property_tree::json_parser::write_json(answer, m_pt); } else { @@ -315,30 +266,11 @@ void ManagementServer::handle_message(zmq::message_t& zmq_message) } } -bool ManagementServer::retrieve_new_ptree(boost::property_tree::ptree& pt) -{ - boost::unique_lock<boost::mutex> lock(m_configmutex); - - if (m_retrieve_pending) - { - pt = m_pt; - - m_retrieve_pending = false; - m_condition.notify_one(); - return true; - } - - return false; -} - void ManagementServer::update_ptree(const boost::property_tree::ptree& pt) { if (m_running) { boost::unique_lock<boost::mutex> lock(m_configmutex); m_pt = pt; - m_pending = false; - - m_condition.notify_one(); } } |