aboutsummaryrefslogtreecommitdiff
path: root/node/node.hpp
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2016-10-13 13:30:44 +0200
committerDennis Brentjes <d.brentjes@gmail.com>2016-10-13 13:30:44 +0200
commitd9587cfd27aa5ef26170ec1983b47f1e26dc8136 (patch)
tree7982a93e7cc7e27a733e613aebfb796058deb57a /node/node.hpp
parentad1a9858cd0d15b1090a0977098b98307875f07c (diff)
downloadcmix-d9587cfd27aa5ef26170ec1983b47f1e26dc8136.tar.gz
cmix-d9587cfd27aa5ef26170ec1983b47f1e26dc8136.tar.bz2
cmix-d9587cfd27aa5ef26170ec1983b47f1e26dc8136.zip
Connecting client now have to send an id to each node.
Diffstat (limited to 'node/node.hpp')
-rw-r--r--node/node.hpp13
1 files changed, 9 insertions, 4 deletions
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<Receiver> purgatory;
- std::list<SenderReceiver> clients;
+
+ typedef std::map<std::string, SenderReceiver> ClientMap;
+ ClientMap clients;
NodeNetworkSettings network_settings;
@@ -43,6 +45,10 @@ class Node
KeyPair keypair;
std::vector<uint8_t> 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<SenderReceiver>::iterator handle, cmix_proto::CMixMessage message);
+ void handle_client_message(ClientMap::key_type handle, cmix_proto::CMixMessage message);
void handle_imanode(std::list<Receiver>::iterator handle);
- void handle_imaclient(std::list<Receiver>::iterator handle);
+ void handle_imaclient(std::list<Receiver>::iterator handle, cmix_proto::ImAClient c);
void handle_message(std::list<ProtobufClient<Receive>>::iterator handle, cmix_proto::CMixMessage message);
-
public:
/*!