aboutsummaryrefslogtreecommitdiff
path: root/network-handler/nodeclient.cpp
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2016-08-30 16:36:14 +0200
committerDennis Brentjes <d.brentjes@gmail.com>2016-08-30 16:36:14 +0200
commitfff831ff736e90fa6175fcb6f3000408218957e7 (patch)
treef48320f1e6ff04a11c38741e9f233634452941d5 /network-handler/nodeclient.cpp
parent5bac5321fa5ab128cee2f0b8c549945bd6a1ccfc (diff)
downloadcmix-fff831ff736e90fa6175fcb6f3000408218957e7.tar.gz
cmix-fff831ff736e90fa6175fcb6f3000408218957e7.tar.bz2
cmix-fff831ff736e90fa6175fcb6f3000408218957e7.zip
Replaced Client based implementation to composition instead of inheritance.
Diffstat (limited to 'network-handler/nodeclient.cpp')
-rw-r--r--network-handler/nodeclient.cpp12
1 files changed, 11 insertions, 1 deletions
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 <iostream>
NodeClient::NodeClient(boost::asio::ip::tcp::socket &&socket)
-: Client(std::move(socket))
+: client(std::move(socket))
{}
void NodeClient::handle_message(std::vector<uint8_t> 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);
+}
+