From d9587cfd27aa5ef26170ec1983b47f1e26dc8136 Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Thu, 13 Oct 2016 13:30:44 +0200 Subject: Connecting client now have to send an id to each node. --- node/node.hpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'node/node.hpp') diff --git a/node/node.hpp b/node/node.hpp index 9f1f3a2..868c4b8 100644 --- a/node/node.hpp +++ b/node/node.hpp @@ -32,7 +32,9 @@ class Node boost::asio::io_service io_service; Server server; std::list purgatory; - std::list clients; + + typedef std::map ClientMap; + ClientMap clients; NodeNetworkSettings network_settings; @@ -43,6 +45,10 @@ class Node KeyPair keypair; std::vector network_pub_key; + bool shutting_down; + + void send_bye(); + void accept_handler(boost::asio::ip::tcp::socket&& socket); void start_precomputation(); @@ -51,12 +57,11 @@ class Node void handle_initialization(cmix_proto::Initialization const& init); void handle_node_message(cmix_proto::CMixMessage message); - void handle_client_message(std::list::iterator handle, cmix_proto::CMixMessage message); + void handle_client_message(ClientMap::key_type handle, cmix_proto::CMixMessage message); void handle_imanode(std::list::iterator handle); - void handle_imaclient(std::list::iterator handle); + void handle_imaclient(std::list::iterator handle, cmix_proto::ImAClient c); void handle_message(std::list>::iterator handle, cmix_proto::CMixMessage message); - public: /*! -- cgit v1.2.3-70-g09d2