From 74cea534fd189a2db423ae60997447e66265922b Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Sun, 27 Nov 2016 10:08:19 +0100 Subject: Implements message delivery. Adds a minimum number of messages per mix. Embeds the destination in the message. Clients now send messages to themselves. --- node/main.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'node/main.cpp') diff --git a/node/main.cpp b/node/main.cpp index acfdafe..02838f1 100644 --- a/node/main.cpp +++ b/node/main.cpp @@ -22,6 +22,7 @@ int main(int argc, char* argv[]) { ("next_node,n", po::value(), "The address of the next node in the network.") ("first,f", "This is the first node and will be the communication point for the clients.") ("last,l", "this is the last node and will be able to send the original message out of the network.") + ("minimum_nr_messages,m", po::value(), "minimum number of messages that needs to accumulate before starting a mix.") ("cert,c", po::value(), "The cert file to use (in pem format).") ("key,k", po::value(), "The key file (in pem format).") ("dhparam,d", po::value(), "The dhparam file.") @@ -93,6 +94,15 @@ int main(int argc, char* argv[]) { BOOST_LOG_TRIVIAL(info) << "Started node"; bool is_first = bool(vm.count("first")); + unsigned int minimum_nr_messages = 0; + if(is_first) { + if(vm.count("minimum_nr_messages")) { + minimum_nr_messages = vm["minimum_nr_messages"].as(); + } else { + std::cerr << "Minimum nr of messages is a required parameter for the first node" << std::endl; + return -1; + } + } bool is_last = bool(vm.count("last")); std::string next_node; if(vm.count("next_node")) { @@ -114,7 +124,7 @@ int main(int argc, char* argv[]) { Uri uri = parse_uri(next_node); - NodeNetworkSettings nsettings{is_first, is_last, uri.host, uri.port, certdir}; + NodeNetworkSettings nsettings{is_first, is_last, uri.host, uri.port, certdir, minimum_nr_messages}; Node node(lsettings, nsettings); node.run(); -- cgit v1.2.3-70-g09d2