From ddb24ebb61cdef4d3b75fcfc3c019c5627b8255d Mon Sep 17 00:00:00 2001 From: Rob Walker Date: Wed, 18 Jul 2018 22:10:01 -0700 Subject: [PATCH] fixups --- src/erasure.rs | 5 +++-- src/streamer.rs | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/erasure.rs b/src/erasure.rs index e138e49695..6cb9090e20 100644 --- a/src/erasure.rs +++ b/src/erasure.rs @@ -167,8 +167,9 @@ pub fn decode_blocks( Ok(()) } -// Generate coding blocks in window starting from consumed, -// for each block place the coding blobs at the end of the block +// Generate coding blocks in window starting from start_idx, +// for num_blobs.. For each block place the coding blobs +// at the end of the block like so: // // block-size part of a Window, with each element a WindowSlot.. // |<======================= NUM_DATA ==============================>| diff --git a/src/streamer.rs b/src/streamer.rs index d5312a6585..b975a2422d 100644 --- a/src/streamer.rs +++ b/src/streamer.rs @@ -328,7 +328,7 @@ fn process_blob( // Search the window for old blobs in the window // of consumed to received and clear any old ones - for ix in *consumed..(pix + 1) { + for ix in *consumed..(received + 1) { let k = (ix % WINDOW_SIZE) as usize; let mut old = false; @@ -337,15 +337,16 @@ fn process_blob( } if old { if let Some(b) = mem::replace(&mut window[k].data, None) { + debug!("{:x}: recycling data blob at index {:}", debug_id, k); recycler.recycle(b); } } - let mut old = false; if let Some(b) = &window[k].coding { old = b.read().unwrap().get_index().unwrap() < *consumed; } if old { if let Some(b) = mem::replace(&mut window[k].coding, None) { + debug!("{:x}: recycling coding blob at index {:}", debug_id, k); recycler.recycle(b); } } @@ -394,6 +395,15 @@ fn process_blob( } } + // // Search the window for wrong data blobs... + // for ix in *consumed..(received + 1) { + // let k = (ix % WINDOW_SIZE) as usize; + // + // if let Some(b) = &window[k].data { + // assert_eq!(ix, b.read().unwrap().get_index().unwrap()); + // } + // } + // push all contiguous blobs into consumed queue, increment consumed while *consumed < received { let k = (*consumed % WINDOW_SIZE) as usize;