Fix erasure compilation

This commit is contained in:
Stephen Akridge 2018-05-24 17:19:49 -07:00 committed by Greg Fitzgerald
parent f1075191fe
commit ea97529185
2 changed files with 9 additions and 4 deletions

View File

@ -153,7 +153,7 @@ pub fn decode_blocks(data: &mut [&mut [u8]], coding: &[&[u8]], erasures: &[i32])
// Generate coding blocks in window from consumed to consumed+NUM_DATA
pub fn generate_coding(
re: &BlobRecycler,
window: &mut Vec<SharedBlob>,
window: &mut Vec<Option<SharedBlob>>,
consumed: usize,
) -> Result<()> {
let mut data_blobs = Vec::new();
@ -183,7 +183,7 @@ pub fn generate_coding(
let coding_end = consumed + NUM_CODED;
for i in coding_start..coding_end {
let n = i % window.len();
window[n] = re.allocate();
window[n] = Some(re.allocate());
coding_blobs.push(
window[n]
.clone()

View File

@ -377,9 +377,14 @@ fn broadcast(
dq.append(&mut nq);
}
let mut blobs = dq.into_iter().collect();
/// appends codes to the list of blobs allowing us to reconstruct the stream
// appends codes to the list of blobs allowing us to reconstruct the stream
#[cfg(feature = "erasure")]
erasure::generate_coding(re, blobs, consumed);
{
match erasure::generate_coding(recycler, &mut window.write().unwrap(), *transmit_index as usize) {
Err(_e) => { return Err(Error::GenericError) }
_ => {}
}
}
Crdt::broadcast(crdt, &blobs, &sock, transmit_index)?;
// keep the cache of blobs that are broadcast
{