fix(awc): prevent panics in pool drop for h1 connections

This commit is contained in:
Rob Ede 2024-08-10 05:25:21 +01:00
parent 538c1bea34
commit c057605eb7
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
2 changed files with 5 additions and 1 deletions

View File

@ -2,6 +2,8 @@
## Unreleased
- Prevent panics on connection pool drop when Tokio runtime is shutdown early.
## 3.5.1
- Fix WebSocket `Host` request header value when using a non-default port.

View File

@ -76,10 +76,12 @@ where
fn close(&self, conn: ConnectionInnerType<Io>) {
if let Some(timeout) = self.config.disconnect_timeout {
if let ConnectionInnerType::H1(io) = conn {
if tokio::runtime::Handle::try_current().is_ok() {
actix_rt::spawn(CloseConnection::new(io, timeout));
}
}
}
}
}
impl<Io> Clone for ConnectionPoolInner<Io>