diff options
Diffstat (limited to 'libcmix-network/client.hpp')
| -rw-r--r-- | libcmix-network/client.hpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libcmix-network/client.hpp b/libcmix-network/client.hpp index 0b98c1c..2501908 100644 --- a/libcmix-network/client.hpp +++ b/libcmix-network/client.hpp @@ -152,17 +152,19 @@ public: os.write(reinterpret_cast<char*>(length_buffer.data()), length_buffer.size()); os.write(message.data(), message.size()); - auto handler = [on_sent](boost::system::error_code const& ec, std::size_t bytes_transferred) { + auto handler = [this, on_sent](boost::system::error_code const& ec, std::size_t bytes_transferred) { if(ec) { BOOST_LOG_TRIVIAL(fatal) << ec.message(); throw std::runtime_error("unable to send message"); } + send_buffer->consume(bytes_transferred); on_sent(); }; + boost::asio::async_write( *socket, - *send_buffer, + send_buffer->data(), handler ); } |
