diff options
Diffstat (limited to 'libcmix-network/client.cpp')
| -rw-r--r-- | libcmix-network/client.cpp | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/libcmix-network/client.cpp b/libcmix-network/client.cpp index f693afa..755989b 100644 --- a/libcmix-network/client.cpp +++ b/libcmix-network/client.cpp @@ -2,13 +2,6 @@ #include "connect.hpp" -#include "logging.hpp" - -#include <boost/asio/placeholders.hpp> -#include <boost/bind.hpp> -#include <boost/asio/buffer.hpp> -#include <boost/array.hpp> - #include <iostream> using namespace boost::asio::ip; @@ -39,26 +32,6 @@ std::array<uint8_t, 4> Client::prepare_length_prefix(uint32_t length) return buf; } -void Client::send(std::string message) { - - auto length_buffer = prepare_length_prefix(message.size()); - - boost::array<boost::asio::const_buffer, 2> package = { - boost::asio::buffer(length_buffer.data(), length_buffer.size()), - boost::asio::buffer(message) - }; - - auto handler = [](boost::system::error_code const& ec, std::size_t bytes_transferred) { - if(ec) { - BOOST_LOG_TRIVIAL(fatal) << ec; - throw std::runtime_error("unable to send message"); - } - }; - - socket.async_send(package, 0, handler); - -} - std::vector<uint8_t> Client::received_bytes_to_vector(size_t read_bytes) { buffer->commit(read_bytes); @@ -103,15 +76,6 @@ void Client::handle_receive_size(Client::MessageHandler message_handler, error_c } } -void Client::receive(MessageHandler message_handler) { - using namespace boost::asio::placeholders; - - socket.async_receive( - buffer->prepare(4), - boost::bind(&Client::handle_receive_size, this, message_handler, error(), bytes_transferred()) - ); -} - void Client::close() { socket.close(); |
