Skip to content

Commit

Permalink
Merge pull request #3 from sakridge/broadcast
Browse files Browse the repository at this point in the history
Fix streamer::window_send_test
  • Loading branch information
aeyakovenko authored May 2, 2018
2 parents e58d260 + 35e4f54 commit a993bab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ impl Packets {
}

const BLOB_INDEX_END: usize = size_of::<u64>();
const BLOB_ID_END: usize = BLOB_INDEX_END + size_of::<PublicKey>();
const BLOB_ID_END: usize = BLOB_INDEX_END + size_of::<usize>() + size_of::<PublicKey>();

impl Blob {
pub fn get_index(&self) -> Result<u64> {
Expand Down
15 changes: 12 additions & 3 deletions src/streamer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,10 @@ mod test {
read.local_addr().unwrap(),
send.local_addr().unwrap(),
serve.local_addr().unwrap());
let subs = Arc::new(RwLock::new(Crdt::new(rep_data)));
let mut crdt_me = Crdt::new(rep_data);
let me_id = crdt_me.my_data().id;
crdt_me.set_leader(me_id);
let subs = Arc::new(RwLock::new(crdt_me));

let resp_recycler = BlobRecycler::default();
let (s_reader, r_reader) = channel();
Expand All @@ -541,6 +544,7 @@ mod test {
let b_ = b.clone();
let mut w = b.write().unwrap();
w.set_index(i).unwrap();
w.set_id(me_id).unwrap();
assert_eq!(i, w.get_index().unwrap());
w.meta.size = PACKET_DATA_SIZE;
w.meta.set_addr(&addr);
Expand Down Expand Up @@ -573,7 +577,10 @@ mod test {
read.local_addr().unwrap(),
send.local_addr().unwrap(),
serve.local_addr().unwrap());
let subs = Arc::new(RwLock::new(Crdt::new(rep_data)));
let mut crdt_me = Crdt::new(rep_data);
let me_id = crdt_me.my_data().id;
crdt_me.set_leader(me_id);
let subs = Arc::new(RwLock::new(crdt_me));

let (s_retransmit, r_retransmit) = channel();
let blob_recycler = BlobRecycler::default();
Expand All @@ -593,7 +600,9 @@ mod test {
let (s_blob_receiver, r_blob_receiver) = channel();
let t_receiver =
blob_receiver(exit.clone(), blob_recycler.clone(), read, s_blob_receiver).unwrap();
let mut oq = r_blob_receiver.recv().unwrap();
let recv = r_blob_receiver.recv();
println!("recv: {:?}", recv);
let mut oq = recv.unwrap();
assert_eq!(oq.len(), 1);
let o = oq.pop_front().unwrap();
let ro = o.read().unwrap();
Expand Down

0 comments on commit a993bab

Please sign in to comment.