1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-11-10 19:01:05 +00:00

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

This commit is contained in:
Rob Ede 2024-08-18 15:54:36 +01:00 committed by GitHub
parent d6bdfac1b9
commit c055723997
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -2,6 +2,7 @@
## Unreleased
- Prevent panics on connection pool drop when Tokio runtime is shutdown early.
- Minimum supported Rust version (MSRV) is now 1.75.
## 3.5.1

View file

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