Skip to content

Commit

Permalink
corrected the count of AUX messages
Browse files Browse the repository at this point in the history
  • Loading branch information
vkomenda committed May 10, 2018
1 parent b6a6bb3 commit 259d536
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
18 changes: 10 additions & 8 deletions src/agreement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,17 @@ impl<NodeUid: Clone + Eq + Hash> Agreement<NodeUid> {
/// can, however, expect every good node to send an AUX value that will
/// eventually end up in our bin_values.
fn count_aux(&self) -> (usize, BTreeSet<bool>) {
let mut vals: BTreeSet<bool> = BTreeSet::new();

for b in self.received_aux.values() {
if self.bin_values.contains(b) {
vals.insert(b.clone());
}
}
let mut count = 0;
let vals: BTreeSet<bool> = self.received_aux
.values()
.filter(|b| {
count += 1;
self.bin_values.contains(b)
})
.cloned()
.collect();

(vals.len(), vals)
(count, vals)
}

/// Waits until at least (N − f) AUX_r messages have been received, such that
Expand Down
3 changes: 1 addition & 2 deletions src/common_subset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ impl<NodeUid: Clone + Debug + Display + Eq + Hash + Ord> CommonSubset<NodeUid> {
let mut result = Err(Error::NoSuchAgreementInstance);

// Send the message to the local instance of Agreement
if let Some(mut agreement_instance) = self.agreement_instances.get_mut(&element_proposer_id)
{
if let Some(agreement_instance) = self.agreement_instances.get_mut(&element_proposer_id) {
// Optional output of agreement and outgoing agreement
// messages to remote nodes.
result = if agreement_instance.terminated() {
Expand Down

0 comments on commit 259d536

Please sign in to comment.