aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/DabMultiplexer.cpp14
-rw-r--r--src/DabMultiplexer.h7
-rw-r--r--src/DabMux.cpp10
-rw-r--r--src/ManagementServer.cpp70
-rw-r--r--src/ManagementServer.h14
5 files changed, 5 insertions, 110 deletions
diff --git a/src/DabMultiplexer.cpp b/src/DabMultiplexer.cpp
index a557db0..c560c96 100644
--- a/src/DabMultiplexer.cpp
+++ b/src/DabMultiplexer.cpp
@@ -83,20 +83,6 @@ DabMultiplexer::DabMultiplexer(
"Set to 1 to use the new carousel");
}
-void DabMultiplexer::update_config(boost::property_tree::ptree pt)
-{
- ensemble_next = std::make_shared<dabEnsemble>();
-
- m_pt_next = pt;
-
- reconfigure();
-}
-
-void DabMultiplexer::reconfigure()
-{
- parse_ptree(m_pt_next, ensemble_next, m_rc);
-}
-
void DabMultiplexer::set_edi_config(const edi_configuration_t& new_edi_conf)
{
edi_conf = new_edi_conf;
diff --git a/src/DabMultiplexer.h b/src/DabMultiplexer.h
index 88e0cb2..ab56090 100644
--- a/src/DabMultiplexer.h
+++ b/src/DabMultiplexer.h
@@ -66,8 +66,6 @@ class DabMultiplexer : public RemoteControllable {
void print_info(void);
- void update_config(boost::property_tree::ptree pt);
-
void set_edi_config(const edi_configuration_t& new_edi_conf);
/* Remote control */
@@ -81,7 +79,6 @@ class DabMultiplexer : public RemoteControllable {
void prepare_subchannels(void);
void prepare_services_components(void);
void prepare_data_inputs(void);
- void reconfigure(void);
boost::property_tree::ptree m_pt;
std::shared_ptr<BaseRemoteController> m_rc;
@@ -98,10 +95,6 @@ class DabMultiplexer : public RemoteControllable {
std::shared_ptr<dabEnsemble> ensemble;
- // Multiplex reconfiguration requires two sets of configurations
- boost::property_tree::ptree m_pt_next;
- std::shared_ptr<dabEnsemble> ensemble_next;
-
ClockTAI m_clock_tai;
#if HAVE_OUTPUT_EDI
diff --git a/src/DabMux.cpp b/src/DabMux.cpp
index 79b46f1..3a4a465 100644
--- a/src/DabMux.cpp
+++ b/src/DabMux.cpp
@@ -473,14 +473,8 @@ int main(int argc, char *argv[])
"Detected Management Server fault, restarting it";
mgmt_server.restart();
}
- else if (mgmt_server.request_pending()) {
- mgmt_server.update_ptree(pt);
- }
- else if (mgmt_server.retrieve_new_ptree(pt)) {
- etiLog.level(warn) <<
- "Detected configuration change";
- mux.update_config(pt);
- }
+
+ mgmt_server.update_ptree(pt);
}
}
etiLog.level(info) << "Goodbye";
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();
}
}
diff --git a/src/ManagementServer.h b/src/ManagementServer.h
index 836dee4..2b9b7b4 100644
--- a/src/ManagementServer.h
+++ b/src/ManagementServer.h
@@ -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
@@ -318,14 +318,12 @@ class ManagementServer
m_zmq_context(),
m_zmq_sock(m_zmq_context, ZMQ_REP),
m_running(false),
- m_fault(false),
- m_pending(false) { }
+ m_fault(false) { }
~ManagementServer()
{
m_running = false;
m_fault = false;
- m_pending = false;
// TODO notify
m_thread.join();
@@ -343,9 +341,6 @@ class ManagementServer
void registerInput(InputStat* is);
void unregisterInput(std::string id);
- /* Ask if there is a configuration request pending */
- bool request_pending() { return m_pending; }
-
/* Load a ptree given by the management server.
*
* Returns true if the ptree was updated
@@ -372,7 +367,6 @@ class ManagementServer
void serverThread(void);
void handle_message(zmq::message_t& zmq_message);
- bool handle_setptree(zmq::message_t& zmq_message, std::stringstream& answer);
bool isInputRegistered(std::string& id);
@@ -410,11 +404,7 @@ class ManagementServer
mutable boost::mutex m_statsmutex;
/******** Configuration Data *******/
- bool m_pending;
- bool m_retrieve_pending;
- boost::condition_variable m_condition;
mutable boost::mutex m_configmutex;
-
boost::property_tree::ptree m_pt;
};