diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2018-11-29 23:42:11 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2018-11-29 23:42:11 +0100 |
| commit | c307f09ca63f5dd609be0b3f1c077cd3bc1a9266 (patch) | |
| tree | 42b72eebcc7cc0c48a81b4c37c824d9887c5443d /src/control_connection.cpp | |
| parent | ac34053c57180b042426d82310d9ff57770387c9 (diff) | |
| download | wanda-c307f09ca63f5dd609be0b3f1c077cd3bc1a9266.tar.xz wanda-c307f09ca63f5dd609be0b3f1c077cd3bc1a9266.zip | |
core: implement message sending
Diffstat (limited to 'src/control_connection.cpp')
| -rw-r--r-- | src/control_connection.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/control_connection.cpp b/src/control_connection.cpp index 88a136e..094a058 100644 --- a/src/control_connection.cpp +++ b/src/control_connection.cpp @@ -34,6 +34,21 @@ void control_connection::start() } } +void control_connection::send(std::string message) +{ + m_output << message; + boost::asio::async_write(m_socket, m_out, boost::asio::transfer_exactly(message.size()), [that = shared_from_this(), this](auto const &error, auto const length) { + if (error) + { + // TODO: Handle error + } + else + { + m_out.consume(length); + } + }); +} + void control_connection::close() { if (auto error = boost::system::error_code{}; m_socket.cancel(error)) |
