From 915010e7338c4c119ff387296185aff8f177ca55 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Tue, 13 Aug 2019 14:55:04 +0200 Subject: [PATCH] Fixes a bug in OpenWaitingConnection where the h2 flow would panic a future (#1031) --- actix-http/src/client/pool.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/actix-http/src/client/pool.rs b/actix-http/src/client/pool.rs index dbd8f202c..24a187392 100644 --- a/actix-http/src/client/pool.rs +++ b/actix-http/src/client/pool.rs @@ -590,6 +590,29 @@ where type Error = (); fn poll(&mut self) -> Poll { + if let Some(ref mut h2) = self.h2 { + return match h2.poll() { + Ok(Async::Ready((snd, connection))) => { + tokio_current_thread::spawn(connection.map_err(|_| ())); + let rx = self.rx.take().unwrap(); + let _ = rx.send(Ok(IoConnection::new( + ConnectionType::H2(snd), + Instant::now(), + Some(Acquired(self.key.clone(), self.inner.take())), + ))); + Ok(Async::Ready(())) + } + Ok(Async::NotReady) => Ok(Async::NotReady), + Err(err) => { + let _ = self.inner.take(); + if let Some(rx) = self.rx.take() { + let _ = rx.send(Err(ConnectError::H2(err))); + } + Err(()) + } + }; + } + match self.fut.poll() { Err(err) => { let _ = self.inner.take();