Skip to content

Commit

Permalink
fix: Pin boxed futures before awaiting in connection handler
Browse files Browse the repository at this point in the history
  • Loading branch information
sanity committed Dec 26, 2024
1 parent f81bd33 commit d5f8d51
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/core/src/transport/connection_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,8 @@ impl<S: Socket> UdpPacketsListener<S> {
let task = tokio::spawn({
let span = tracing::span!(tracing::Level::DEBUG, "gateway_connection");
async move {
match gw_ongoing_connection.await {
let pinned = Box::pin(gw_ongoing_connection);
match pinned.await {
Ok(result) => Ok(result),
Err(error) => Err((error, remote_addr))
}
Expand Down Expand Up @@ -380,7 +381,8 @@ impl<S: Socket> UdpPacketsListener<S> {
let task = tokio::spawn({
let span = span!(tracing::Level::DEBUG, "traverse_nat");
async move {
match ongoing_connection.await {
let pinned = Box::pin(ongoing_connection);
match pinned.await {
Ok(result) => Ok(result),
Err(error) => Err((error, remote_addr))
}
Expand Down

0 comments on commit d5f8d51

Please sign in to comment.