Skip to content

Commit

Permalink
Handle set_flags error
Browse files Browse the repository at this point in the history
  • Loading branch information
sakridge committed Jun 2, 2018
1 parent 1b400df commit 8ac9293
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/erasure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const NUM_DATA: usize = NUM_CODED - MAX_MISSING;
pub enum ErasureError {
NotEnoughBlocksToDecode,
DecodeError,
EncodeError,
InvalidBlockSize,
}

Expand Down Expand Up @@ -229,7 +230,9 @@ pub fn generate_coding(window: &mut Vec<Option<SharedBlob>>, consumed: usize) ->
let w_l = window[n].clone().unwrap();
w_l.write().unwrap().meta.size = max_data_size;
let flags = w_l.write().unwrap().get_flags().unwrap();
w_l.write().unwrap().set_flags(flags | BLOB_FLAG_IS_CODING);
if w_l.write().unwrap().set_flags(flags | BLOB_FLAG_IS_CODING).is_err() {
return Err(ErasureError::EncodeError);
}
coding_blobs.push(
window[n]
.clone()
Expand Down

0 comments on commit 8ac9293

Please sign in to comment.