summaryrefslogtreecommitdiffstats
path: root/src/RemoteControl.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-10-10 10:30:11 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-10-10 10:30:11 +0200
commit5b410d7d1f398272cef6a031b561377bed3694f7 (patch)
treeb55f87562d553f67d21728b885a31fdfb336d19b /src/RemoteControl.cpp
parente2e1a0f374aeffc933d0e5d295607197d6b74a4a (diff)
downloaddabmux-5b410d7d1f398272cef6a031b561377bed3694f7.tar.gz
dabmux-5b410d7d1f398272cef6a031b561377bed3694f7.tar.bz2
dabmux-5b410d7d1f398272cef6a031b561377bed3694f7.zip
Replace m_running by m_active in RC
Diffstat (limited to 'src/RemoteControl.cpp')
-rw-r--r--src/RemoteControl.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/RemoteControl.cpp b/src/RemoteControl.cpp
index 9ee1f24..305334b 100644
--- a/src/RemoteControl.cpp
+++ b/src/RemoteControl.cpp
@@ -85,13 +85,13 @@ void RemoteControllers::set_param(
// thread.
void RemoteControllerTelnet::restart_thread(long)
{
- m_running = false;
-
if (m_port) {
m_child_thread.interrupt();
m_child_thread.join();
}
+ m_fault = false;
+
m_child_thread = boost::thread(&RemoteControllerTelnet::process, this, 0);
}
@@ -110,7 +110,7 @@ void RemoteControllerTelnet::process(long)
tcp::acceptor acceptor(io_service, tcp::endpoint(
boost::asio::ip::address::from_string("127.0.0.1"), m_port) );
- while (m_running) {
+ while (m_active) {
in_message = "";
tcp::socket socket(io_service);
@@ -123,7 +123,7 @@ void RemoteControllerTelnet::process(long)
boost::asio::transfer_all(),
ignored_error);
- while (m_running && in_message != "quit") {
+ while (m_active && in_message != "quit") {
boost::asio::write(socket, boost::asio::buffer(m_prompt),
boost::asio::transfer_all(),
ignored_error);
@@ -160,7 +160,8 @@ void RemoteControllerTelnet::process(long)
}
}
catch (std::exception& e) {
- std::cerr << "Remote control caught exception: " << e.what() << std::endl;
+ etiLog.level(error) <<
+ "Remote control caught exception: " << e.what();
m_fault = true;
}
}
@@ -293,7 +294,7 @@ void RemoteControllerZmq::restart()
// thread.
void RemoteControllerZmq::restart_thread()
{
- m_running = false;
+ m_active = false;
if (!m_endpoint.empty()) {
m_child_thread.interrupt();
@@ -352,7 +353,7 @@ void RemoteControllerZmq::process()
// create pollitem that polls the ZMQ sockets
zmq::pollitem_t pollItems[] = { {repSocket, 0, ZMQ_POLLIN, 0} };
- for (;;) {
+ while (m_active) {
zmq::poll(pollItems, 1, 100);
std::vector<std::string> msg;