From fff831ff736e90fa6175fcb6f3000408218957e7 Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Tue, 30 Aug 2016 16:36:14 +0200 Subject: Replaced Client based implementation to composition instead of inheritance. --- network-handler/nodeclient.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'network-handler/nodeclient.cpp') diff --git a/network-handler/nodeclient.cpp b/network-handler/nodeclient.cpp index 8486f4b..9b026ba 100644 --- a/network-handler/nodeclient.cpp +++ b/network-handler/nodeclient.cpp @@ -3,10 +3,20 @@ #include NodeClient::NodeClient(boost::asio::ip::tcp::socket &&socket) -: Client(std::move(socket)) +: client(std::move(socket)) {} void NodeClient::handle_message(std::vector message) { std::cout << std::string(message.begin(), message.end()) << std::endl; } + +void NodeClient::receive() +{ + client.receive(std::bind(&NodeClient::handle_message, this, std::placeholders::_1)); +} + +void NodeClient::on_done(Client::OnDoneFT done) { + client.on_done(done); +} + -- cgit v1.2.3-70-g09d2