From a710d95243590ab3ffe5482c4b779d2db9f6b064 Mon Sep 17 00:00:00 2001 From: Stephen Akridge Date: Tue, 5 Jun 2018 12:30:08 -0700 Subject: [PATCH] Fix non-erasure blob nulling --- src/streamer.rs | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/streamer.rs b/src/streamer.rs index d0a931d422..71c4877e5c 100644 --- a/src/streamer.rs +++ b/src/streamer.rs @@ -319,19 +319,27 @@ fn recv_window( if !is_coding { contq.push_back(window[k].clone().expect("clone in fn recv_window")); *consumed += 1; - } else { - let block_start = *consumed - (*consumed % erasure::NUM_CODED); - let coding_end = block_start + erasure::NUM_CODED; - // We've received all this block's data blobs, go and null out the window now - for j in block_start..coding_end { - window[j % WINDOW_SIZE] = None; - } - *consumed += erasure::MAX_MISSING; - debug!( - "skipping processing coding blob k: {} consumed: {}", - k, *consumed - ); + #[cfg(not(feature = "erasure"))] + { + window[k] = None; + } + } else { + #[cfg(feature = "erasure")] + { + let block_start = *consumed - (*consumed % erasure::NUM_CODED); + let coding_end = block_start + erasure::NUM_CODED; + // We've received all this block's data blobs, go and null out the window now + for j in block_start..coding_end { + window[j % WINDOW_SIZE] = None; + } + + *consumed += erasure::MAX_MISSING; + debug!( + "skipping processing coding blob k: {} consumed: {}", + k, *consumed + ); + } } } }