From e10d559b75ee5456cbb73ad01f38517163b9e674 Mon Sep 17 00:00:00 2001 From: Stephen Akridge Date: Mon, 30 Apr 2018 12:52:54 -0700 Subject: [PATCH] compilation fixes --- src/crdt.rs | 15 ++++++++------- src/lib.rs | 4 ++-- src/streamer.rs | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/crdt.rs b/src/crdt.rs index 66e08f51915ee3..8235ef7593d720 100644 --- a/src/crdt.rs +++ b/src/crdt.rs @@ -55,7 +55,7 @@ impl ReplicatedData { gossip_addr: SocketAddr, replicate_addr: SocketAddr, serve_addr: SocketAddr) -> ReplicatedData { - let daddr = "0.0.0.0:0".parse().unwrap(); + let daddr:SocketAddr = "0.0.0.0:0".parse().unwrap(); ReplicatedData { id, sig: Signature::default(), @@ -122,11 +122,11 @@ impl Crdt { g.table.insert(me.id, me); g } - pub fn my_data(&self) -> ReplicatedData { - self.table[&self.me] + pub fn my_data(&self) -> &ReplicatedData { + &self.table[&self.me] } - pub fn leader_data(&self) -> ReplicatedData { - self.table[&self.table[&self.me].current_leader_id] + pub fn leader_data(&self) -> &ReplicatedData { + &self.table[&self.table[&self.me].current_leader_id] } pub fn insert(&mut self, v: &ReplicatedData) { // TODO check that last_verified types are always increasing @@ -151,10 +151,11 @@ impl Crdt { s: &UdpSocket, transmit_index: &mut u64 ) -> Result<()> { - let (me, table): (ReplicatedData, Vec) = { + let (me, table): (&ReplicatedData, Vec) = { // copy to avoid locking durring IO let robj = obj.read().unwrap(); - (robj.table[&robj.me], robj.table.values().cloned().collect()) + let cloned_table:Vec = robj.table.values().cloned().collect(); + (&cloned_table[&robj.me], cloned_table) }; let errs: Vec<_> = table.iter() .enumerate() diff --git a/src/lib.rs b/src/lib.rs index 27c3fbc508e1a6..1f285ef8801764 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,7 @@ #![cfg_attr(feature = "unstable", feature(test))] pub mod accountant; -pub mod accountant_skel; -pub mod accountant_stub; +//pub mod accountant_skel; +//pub mod accountant_stub; pub mod crdt; pub mod ecdsa; pub mod entry; diff --git a/src/streamer.rs b/src/streamer.rs index 2974e2753ea69f..423ee45c091398 100644 --- a/src/streamer.rs +++ b/src/streamer.rs @@ -241,7 +241,7 @@ fn broadcast( #[cfg(feature = "erasure")] erasure::generate_codes(blobs); Crdt::broadcast(crdt, &blobs, &sock, transmit_index)?; - while let Some(b) = dq.pop_front() { + while let Some(b) = blobs.pop() { recycler.recycle(b); } Ok(())