Skip to content

Commit

Permalink
fix(awc): prevent panics in pool drop for h1 connections (#3448)
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede authored Aug 18, 2024
1 parent d6bdfac commit c055723
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions awc/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion awc/src/client/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
}
}
Expand Down

0 comments on commit c055723

Please sign in to comment.