diff options
Diffstat (limited to 'node/node.cpp')
| -rw-r--r-- | node/node.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/node/node.cpp b/node/node.cpp index dc0d1c0..2407138 100644 --- a/node/node.cpp +++ b/node/node.cpp @@ -148,7 +148,7 @@ void Node::start_precomputation() { } BOOST_LOG_TRIVIAL(trace) << "Starting precomputation for " << messages.size() << " clients."; - index_map.clear(); + participants.clear(); if(messages.size() < network_settings.minimum_nr_messages) { start_timer_delayed_mix(); @@ -159,9 +159,8 @@ void Node::start_precomputation() { exit(-1); } - unsigned int i = 0; for(auto&& pair : messages) { - index_map[pair.first] = i++; + participants.push_back(pair.first); } if(initialize_mix_randomness(&cmix_ctx) != no_error) { @@ -170,7 +169,7 @@ void Node::start_precomputation() { std::stringstream ss; ss << "permutation:"; - for(auto i = 0; i < cmix_ctx.nr_participants; ++i) { + for(auto i = 0u; i < cmix_ctx.nr_participants; ++i) { ss << " " << cmix_ctx.permutation[i]; } BOOST_LOG_TRIVIAL(trace) << ss.str(); @@ -228,13 +227,12 @@ void Node::start_realtime_phase() { size_t len = get_group_element_array_size(&cmix_ctx); - std::vector<char*> ms(index_map.size(), nullptr); - std::vector<char const*> msv(index_map.size(), nullptr); - std::vector<GroupElement> keys(index_map.size(), nullptr); - auto it = index_map.begin(); - for(size_t i = 0; i < index_map.size(); ++i) { - auto handle = it->first; - auto index = it->second; + std::vector<char*> ms(participants.size(), nullptr); + std::vector<char const*> msv(participants.size(), nullptr); + std::vector<GroupElement> keys(participants.size(), nullptr); + auto it = participants.begin(); + for(size_t i = 0; i < participants.size(); ++i) { + auto handle = *it; std::string* m = realpre.add_m(); m->resize(len); @@ -270,8 +268,8 @@ void Node::start_realtime_phase() { next_node.async_send(realpre); - for(auto&& pair : index_map) { - messages.at(pair.first).pop(); + for(auto&& handle : participants) { + messages.at(handle).pop(); } } |
