Skip to content

Commit

Permalink
Fix stream draining for http/2 connections #290
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed Jul 25, 2018
1 parent f580650 commit 80fbc2e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

* Missing response header "content-encoding" #421

* Fix stream draining for http/2 connections #290


## [0.7.1] - 2018-07-21

Expand Down
2 changes: 1 addition & 1 deletion src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ struct ProcessResponse<S, H> {
_h: PhantomData<H>,
}

#[derive(PartialEq)]
#[derive(PartialEq, Debug)]
enum RunningState {
Running,
Paused,
Expand Down
4 changes: 3 additions & 1 deletion src/server/h2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ where
}
}

if !item.flags.contains(EntryFlags::WRITE_DONE) {
if item.flags.contains(EntryFlags::FINISHED)
&& !item.flags.contains(EntryFlags::WRITE_DONE)
{
match item.stream.poll_completed(false) {
Ok(Async::NotReady) => (),
Ok(Async::Ready(_)) => {
Expand Down
8 changes: 6 additions & 2 deletions src/server/h2writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,18 @@ impl<H: 'static> Writer for H2Writer<H> {
let cap = cmp::min(self.buffer.len(), CHUNK_SIZE);
stream.reserve_capacity(cap);
} else {
if eof {
stream.reserve_capacity(0);
continue;
}
self.flags.remove(Flags::RESERVED);
return Ok(Async::NotReady);
return Ok(Async::Ready(()));
}
}
Err(e) => return Err(io::Error::new(io::ErrorKind::Other, e)),
}
}
}
Ok(Async::NotReady)
Ok(Async::Ready(()))
}
}

0 comments on commit 80fbc2e

Please sign in to comment.