mirror of
https://github.com/actix/actix-web.git
synced 2024-11-22 09:31:10 +00:00
fix(awc): prevent panics in pool drop for h1 connections (#3448)
This commit is contained in:
parent
d6bdfac1b9
commit
c055723997
2 changed files with 4 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- Prevent panics on connection pool drop when Tokio runtime is shutdown early.
|
||||||
- Minimum supported Rust version (MSRV) is now 1.75.
|
- Minimum supported Rust version (MSRV) is now 1.75.
|
||||||
|
|
||||||
## 3.5.1
|
## 3.5.1
|
||||||
|
|
|
@ -76,11 +76,13 @@ where
|
||||||
fn close(&self, conn: ConnectionInnerType<Io>) {
|
fn close(&self, conn: ConnectionInnerType<Io>) {
|
||||||
if let Some(timeout) = self.config.disconnect_timeout {
|
if let Some(timeout) = self.config.disconnect_timeout {
|
||||||
if let ConnectionInnerType::H1(io) = conn {
|
if let ConnectionInnerType::H1(io) = conn {
|
||||||
|
if tokio::runtime::Handle::try_current().is_ok() {
|
||||||
actix_rt::spawn(CloseConnection::new(io, timeout));
|
actix_rt::spawn(CloseConnection::new(io, timeout));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<Io> Clone for ConnectionPoolInner<Io>
|
impl<Io> Clone for ConnectionPoolInner<Io>
|
||||||
where
|
where
|
||||||
|
|
Loading…
Reference in a new issue