Skip to content

Commit

Permalink
Merge pull request #91 from brave/msmt-mismatch-handle
Browse files Browse the repository at this point in the history
Handle measurement mismatch errors, add debug logging
  • Loading branch information
DJAndries authored Nov 21, 2023
2 parents 8f831e8 + 7730c7a commit 889d4d9
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/star.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,22 @@ pub fn recover_msgs(
None
};

Ok(MsgRecoveryInfo {
measurement: get_measurement_contents(
pms.iter().find(|v| v.is_ok()).unwrap().as_ref().unwrap(),
)?,
next_layer_messages,
error_count,
})
match pms.iter().find(|v| v.is_ok()) {
None => {
let first_error = pms.iter().next().unwrap().clone().unwrap_err();
for result in pms {
if let Err(e) = result {
debug!("recovery failure: {}", e);
}
}
Err(AppSTARError::Recovery(first_error))
}
Some(measurement) => Ok(MsgRecoveryInfo {
measurement: get_measurement_contents(measurement.as_ref().unwrap())?,
next_layer_messages,
error_count,
}),
}
}

#[cfg(test)]
Expand Down

0 comments on commit 889d4d9

Please sign in to comment.