refactor(client): skip some pool housekeeping on shared h2 handles

This commit is contained in:
Sean McArthur
2018-04-18 16:36:52 -07:00
parent 38eba1540f
commit 1328412f82
3 changed files with 59 additions and 23 deletions

View File

@@ -255,6 +255,8 @@ where C: Connect + Sync + 'static,
}
})
.and_then(move |mut res| {
// If pooled is HTTP/2, we can toss this reference immediately.
//
// when pooled is dropped, it will try to insert back into the
// pool. To delay that, spawn a future that completes once the
// sender is ready again.
@@ -263,7 +265,7 @@ where C: Connect + Sync + 'static,
// for a new request to start.
//
// It won't be ready if there is a body to stream.
if pooled.is_ready() {
if ver == Ver::Http2 || pooled.is_ready() {
drop(pooled);
} else if !res.body().is_empty() {
let (delayed_tx, delayed_rx) = oneshot::channel();