From 5455e8e6a99378fdfce016a7fd290782dd7907e6 Mon Sep 17 00:00:00 2001 From: Stephen Akridge Date: Tue, 29 May 2018 18:50:36 -0700 Subject: [PATCH] Review comments --- src/crdt.rs | 19 +++++++------------ src/streamer.rs | 6 +++--- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/crdt.rs b/src/crdt.rs index 0fa01841b1..764b01b556 100644 --- a/src/crdt.rs +++ b/src/crdt.rs @@ -241,18 +241,13 @@ impl Crdt { }; // enumerate all the blobs, those are the indices - let orders: Vec<_> = blobs.iter().enumerate().collect(); - info!("orders table {}", orders.len()); - let _: Vec<_> = orders - .into_iter() - .map(|(i, b)| { - // only leader should be broadcasting - let mut blob = b.write().expect("'blob' write lock in crdt::index_blobs"); - blob.set_id(me.id).expect("set_id in pub fn broadcast"); - blob.set_index(*transmit_index + i as u64) - .expect("set_index in pub fn broadcast"); - }) - .collect(); + for (i, b) in blobs.iter().enumerate() { + // only leader should be broadcasting + let mut blob = b.write().expect("'blob' write lock in crdt::index_blobs"); + blob.set_id(me.id).expect("set_id in pub fn broadcast"); + blob.set_index(*transmit_index + i as u64) + .expect("set_index in pub fn broadcast"); + } info!("set blobs index"); Ok(()) diff --git a/src/streamer.rs b/src/streamer.rs index 4f38a6f56f..8453a4b9af 100644 --- a/src/streamer.rs +++ b/src/streamer.rs @@ -414,9 +414,9 @@ fn broadcast( // Fill in the coding blob data from the window data blobs #[cfg(feature = "erasure")] { - match erasure::generate_coding(&mut window.write().unwrap(), *transmit_index as usize) { - Err(_e) => return Err(Error::GenericError), - _ => {} + if erasure::generate_coding(&mut window.write().unwrap(), *transmit_index as usize).is_err() + { + return Err(Error::GenericError); } }