summaryrefslogtreecommitdiffstats
path: root/src/RemoteControl.h
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.h
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.h')
-rw-r--r--src/RemoteControl.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/RemoteControl.h b/src/RemoteControl.h
index 1a81b42..da6f9ea 100644
--- a/src/RemoteControl.h
+++ b/src/RemoteControl.h
@@ -198,11 +198,11 @@ extern RemoteControllers rcs;
class RemoteControllerTelnet : public BaseRemoteController {
public:
RemoteControllerTelnet()
- : m_running(false), m_fault(false),
+ : m_active(false), m_fault(false),
m_port(0) { }
RemoteControllerTelnet(int port)
- : m_running(true), m_fault(false),
+ : m_active(port > 0), m_fault(false),
m_child_thread(&RemoteControllerTelnet::process, this, 0),
m_port(port) { }
@@ -210,7 +210,7 @@ class RemoteControllerTelnet : public BaseRemoteController {
RemoteControllerTelnet(const RemoteControllerTelnet& other) = delete;
~RemoteControllerTelnet() {
- m_running = false;
+ m_active = false;
m_fault = false;
if (m_port) {
m_child_thread.interrupt();
@@ -243,7 +243,7 @@ class RemoteControllerTelnet : public BaseRemoteController {
return all_tokens;
}
- std::atomic<bool> m_running;
+ std::atomic<bool> m_active;
/* This is set to true if a fault occurred */
std::atomic<bool> m_fault;
@@ -261,12 +261,12 @@ class RemoteControllerTelnet : public BaseRemoteController {
class RemoteControllerZmq : public BaseRemoteController {
public:
RemoteControllerZmq()
- : m_running(false), m_fault(false),
+ : m_active(false), m_fault(false),
m_zmqContext(1),
m_endpoint("") { }
RemoteControllerZmq(const std::string& endpoint)
- : m_running(true), m_fault(false),
+ : m_active(not endpoint.empty()), m_fault(false),
m_zmqContext(1),
m_endpoint(endpoint),
m_child_thread(&RemoteControllerZmq::process, this) { }
@@ -275,8 +275,10 @@ class RemoteControllerZmq : public BaseRemoteController {
RemoteControllerZmq(const RemoteControllerZmq& other) = delete;
~RemoteControllerZmq() {
- m_running = false;
+ m_active = false;
m_fault = false;
+
+ m_zmqContext.close();
if (!m_endpoint.empty()) {
m_child_thread.interrupt();
m_child_thread.join();
@@ -295,7 +297,7 @@ class RemoteControllerZmq : public BaseRemoteController {
void send_fail_reply(zmq::socket_t &pSocket, const std::string &error);
void process();
- std::atomic<bool> m_running;
+ std::atomic<bool> m_active;
/* This is set to true if a fault occurred */
std::atomic<bool> m_fault;