fix Body to return errors when there is recv error

This commit is contained in:
Sean McArthur
2017-09-11 14:46:46 -07:00
parent ed472f109c
commit e2cda1860b
3 changed files with 17 additions and 32 deletions

View File

@@ -314,14 +314,15 @@ impl State {
}
}
pub fn ensure_recv_open(&self) -> Result<(), proto::Error> {
pub fn ensure_recv_open(&self) -> Result<bool, proto::Error> {
use std::io;
// TODO: Is this correct?
match self.inner {
Closed(Some(Cause::Proto(reason))) => Err(proto::Error::Proto(reason)),
Closed(Some(Cause::Io)) => Err(proto::Error::Io(io::ErrorKind::BrokenPipe.into())),
_ => Ok(()),
Closed(None) | HalfClosedRemote(..) => Ok(false),
_ => Ok(true),
}
}
}