From ad1a9858cd0d15b1090a0977098b98307875f07c Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Thu, 13 Oct 2016 10:27:47 +0200 Subject: Added a stop condition for the client, When all the nodes have send a bye to the client, the client will shut down. --- libcmix-network/client.cpp | 5 +++++ libcmix-network/client.hpp | 2 ++ libcmix-network/protobufclient.hpp | 4 ++++ 3 files changed, 11 insertions(+) (limited to 'libcmix-network') diff --git a/libcmix-network/client.cpp b/libcmix-network/client.cpp index 755989b..09ea98c 100644 --- a/libcmix-network/client.cpp +++ b/libcmix-network/client.cpp @@ -84,3 +84,8 @@ void Client::close() void Client::on_done(Client::OnDoneFT f) { done = f; } + +bool Client::is_open() const +{ + return socket.is_open(); +} diff --git a/libcmix-network/client.hpp b/libcmix-network/client.hpp index 7bfea7d..7b88282 100644 --- a/libcmix-network/client.hpp +++ b/libcmix-network/client.hpp @@ -125,5 +125,7 @@ public: */ void on_done(OnDoneFT f); + bool is_open() const; + }; diff --git a/libcmix-network/protobufclient.hpp b/libcmix-network/protobufclient.hpp index 1c97cfa..077ce62 100644 --- a/libcmix-network/protobufclient.hpp +++ b/libcmix-network/protobufclient.hpp @@ -128,6 +128,10 @@ public: client.on_done(f); } + bool is_open() const{ + return client.is_open(); + } + friend Receiver make_receiver(Receiver&& r); friend SenderReceiver make_sender_receiver(SenderReceiver&& r); -- cgit v1.2.3-70-g09d2