pxar_backup_stream.rs: limit lock scope to avoid blocking forever
This commit is contained in:
parent
684233aa3b
commit
6c3c9bceb5
@ -80,10 +80,12 @@ impl Stream for PxarBackupStream {
|
||||
type Error = Error;
|
||||
|
||||
fn poll(&mut self) -> Poll<Option<Vec<u8>>, Error> {
|
||||
{ // limit lock scope
|
||||
let error = self.error.lock().unwrap();
|
||||
if let Some(ref msg) = *error {
|
||||
return Err(format_err!("{}", msg));
|
||||
}
|
||||
}
|
||||
self.stream.as_mut().unwrap().poll().map_err(Error::from)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user