Skip to content

Commit

Permalink
fix(awc): prevent panics in pool drop for h1 connections
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede committed Aug 10, 2024
1 parent 538c1be commit 6fec423
Showing 1 changed file with 3 additions and 1 deletion.
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 6fec423

Please sign in to comment.