aboutsummaryrefslogtreecommitdiff
path: root/src/control_connection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/control_connection.cpp')
-rw-r--r--src/control_connection.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/control_connection.cpp b/src/control_connection.cpp
index c06d489..b0d30d6 100644
--- a/src/control_connection.cpp
+++ b/src/control_connection.cpp
@@ -30,9 +30,9 @@ bool control_connection::remove(listener * listener)
void control_connection::start()
{
- if (!m_running)
+ if (m_state == state::unknown)
{
- m_running = true;
+ m_state = state::fresh;
perform_read();
}
}
@@ -77,6 +77,16 @@ void control_connection::close()
m_listeners.clear();
}
+void control_connection::update(state state)
+{
+ m_state = state;
+}
+
+control_connection::state control_connection::current_state() const
+{
+ return m_state;
+}
+
void control_connection::perform_read()
{
boost::asio::async_read_until(m_socket, m_in, '\n', [that = shared_from_this(), this](auto const &error, auto const length) {