fix(client): always wait on reads for pooled connections

This commit is contained in:
Sean McArthur
2017-11-28 16:17:20 -08:00
parent 60d0eaf891
commit 9f21241002
2 changed files with 15 additions and 25 deletions

View File

@@ -102,16 +102,7 @@ where I: AsyncRead + AsyncWrite,
pub fn can_read_head(&self) -> bool {
match self.state.reading {
Reading::Init => {
if T::should_read_first() {
true
} else {
match self.state.writing {
Writing::Init => false,
_ => true,
}
}
}
Reading::Init => true,
_ => false,
}
}
@@ -245,19 +236,13 @@ where I: AsyncRead + AsyncWrite,
Reading::Closed => false,
};
let wants_write = match self.state.writing {
match self.state.writing {
Writing::Continue(..) |
Writing::Body(..) |
Writing::Ending(..) => return,
Writing::Init => true,
Writing::KeepAlive => false,
Writing::Closed => false,
};
// if the client is at Reading::Init and Writing::Init,
// it's not actually looking for a read, but a write.
if wants_write && !T::should_read_first() {
return;
Writing::Init |
Writing::KeepAlive |
Writing::Closed => (),
}
if !self.io.is_read_blocked() {