From f75ac25e6e93ab167b5f3cfdecbbbf286fdc4fed Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 24 Jan 2014 14:11:19 +0100 Subject: Implement remote control and global_stats, and add to configuration --- src/RemoteControl.h | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/RemoteControl.h') diff --git a/src/RemoteControl.h b/src/RemoteControl.h index 77dbff4..7dcda0a 100644 --- a/src/RemoteControl.h +++ b/src/RemoteControl.h @@ -123,20 +123,20 @@ class RemoteControllable { */ class RemoteControllerTelnet : public BaseRemoteController { public: - RemoteControllerTelnet(int port) { - m_port = port; - m_running = false; - }; + RemoteControllerTelnet() + : m_running(false), m_port(0) {} - void start() { - m_running = true; - m_child_thread = boost::thread(&RemoteControllerTelnet::process, this, 0); - } + RemoteControllerTelnet(int port) + : m_running(true), m_port(port), + m_child_thread(&RemoteControllerTelnet::process, this, 0) + {} - void stop() { + ~RemoteControllerTelnet() { m_running = false; - m_child_thread.interrupt(); - m_child_thread.join(); + if (m_port) { + m_child_thread.interrupt(); + m_child_thread.join(); + } } void process(long); @@ -151,6 +151,9 @@ class RemoteControllerTelnet : public BaseRemoteController { private: + RemoteControllerTelnet& operator=(const RemoteControllerTelnet& other); + RemoteControllerTelnet(const RemoteControllerTelnet& other); + vector tokenise_(string message) { vector all_tokens; -- cgit v1.2.3