aboutsummaryrefslogtreecommitdiff
path: root/node/main.cpp
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2016-11-27 10:08:19 +0100
committerDennis Brentjes <d.brentjes@gmail.com>2016-11-27 10:08:19 +0100
commit74cea534fd189a2db423ae60997447e66265922b (patch)
treedecc06fa5da1f3f42612d527462d22ee487bf2db /node/main.cpp
parentfa7a48172a3c9d9c2f96d6f9c05d80f497bc304d (diff)
downloadcmix-74cea534fd189a2db423ae60997447e66265922b.tar.gz
cmix-74cea534fd189a2db423ae60997447e66265922b.tar.bz2
cmix-74cea534fd189a2db423ae60997447e66265922b.zip
Implements message delivery.
Adds a minimum number of messages per mix. Embeds the destination in the message. Clients now send messages to themselves.
Diffstat (limited to 'node/main.cpp')
-rw-r--r--node/main.cpp12
1 files changed, 11 insertions, 1 deletions
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<std::string>(), "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<unsigned int>(), "minimum number of messages that needs to accumulate before starting a mix.")
("cert,c", po::value<std::string>(), "The cert file to use (in pem format).")
("key,k", po::value<std::string>(), "The key file (in pem format).")
("dhparam,d", po::value<std::string>(), "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<unsigned int>();
+ } 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();