Don't null blob window until we have to
This commit is contained in:
committed by
Greg Fitzgerald
parent
7b4a378c92
commit
799b249f02
@ -303,9 +303,22 @@ fn recv_window(
|
|||||||
debug!("duplicate blob at index {:}", w);
|
debug!("duplicate blob at index {:}", w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// recycle old references
|
||||||
|
for ix in *consumed..pix {
|
||||||
|
let k = (ix % WINDOW_SIZE) as usize;
|
||||||
|
if let Some(b) = &mut window[k] {
|
||||||
|
if b.read().unwrap().get_index().unwrap() >= *consumed as u64 {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let Some(b) = mem::replace(&mut window[k], None) {
|
||||||
|
recycler.recycle(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
loop {
|
loop {
|
||||||
let k = (*consumed % WINDOW_SIZE) as usize;
|
let k = (*consumed % WINDOW_SIZE) as usize;
|
||||||
trace!("k: {} consumed: {}", k, *consumed);
|
trace!("k: {} consumed: {}", k, *consumed);
|
||||||
|
|
||||||
if window[k].is_none() {
|
if window[k].is_none() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -322,11 +335,6 @@ fn recv_window(
|
|||||||
if !is_coding {
|
if !is_coding {
|
||||||
contq.push_back(window[k].clone().expect("clone in fn recv_window"));
|
contq.push_back(window[k].clone().expect("clone in fn recv_window"));
|
||||||
*consumed += 1;
|
*consumed += 1;
|
||||||
|
|
||||||
#[cfg(not(feature = "erasure"))]
|
|
||||||
{
|
|
||||||
window[k] = None;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
#[cfg(feature = "erasure")]
|
#[cfg(feature = "erasure")]
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user