diff --git a/crates/core/src/transport/connection_handler.rs b/crates/core/src/transport/connection_handler.rs index 991c1fb0b..d5903fe5d 100644 --- a/crates/core/src/transport/connection_handler.rs +++ b/crates/core/src/transport/connection_handler.rs @@ -292,9 +292,10 @@ impl UdpPacketsListener { let span = tracing::span!(tracing::Level::DEBUG, "gateway_connection"); async move { let future = Box::pin(gw_ongoing_connection); - match futures::Future::poll(Pin::new(&future), &mut std::task::Context::from_waker(futures::task::noop_waker_ref())) { - Ok(result) => Ok(result), - Err(error) => Err((error, remote_addr)) + match futures::Future::poll(unsafe { Pin::new_unchecked(&mut future) }, &mut std::task::Context::from_waker(futures::task::noop_waker_ref())) { + std::task::Poll::Ready(Ok(result)) => Ok(result), + std::task::Poll::Ready(Err(error)) => Err((error, remote_addr)), + std::task::Poll::Pending => Ok(result) } } .instrument(span) @@ -383,9 +384,10 @@ impl UdpPacketsListener { let span = span!(tracing::Level::DEBUG, "traverse_nat"); async move { let future = Box::pin(ongoing_connection); - match futures::Future::poll(Pin::new(&future), &mut std::task::Context::from_waker(futures::task::noop_waker_ref())) { - Ok(result) => Ok(result), - Err(error) => Err((error, remote_addr)) + match futures::Future::poll(unsafe { Pin::new_unchecked(&mut future) }, &mut std::task::Context::from_waker(futures::task::noop_waker_ref())) { + std::task::Poll::Ready(Ok(result)) => Ok(result), + std::task::Poll::Ready(Err(error)) => Err((error, remote_addr)), + std::task::Poll::Pending => Ok(result) } } .instrument(span)