Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix streamer::window_send_test #3

Merged
merged 1 commit into from
May 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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