From cf30751b4d420f02ce437aa9d8fedd9ce86df8a5 Mon Sep 17 00:00:00 2001 From: Frando Date: Thu, 15 May 2025 12:40:26 +0000 Subject: [PATCH] deploy: 827b12a66d309ba559d646754c63e5cacf0af3a7 --- .../src/iroh/magicsock/relay_actor.rs.html | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pr/3309/docs/src/iroh/magicsock/relay_actor.rs.html b/pr/3309/docs/src/iroh/magicsock/relay_actor.rs.html index e8e1cd1abb..c0e1c3b021 100644 --- a/pr/3309/docs/src/iroh/magicsock/relay_actor.rs.html +++ b/pr/3309/docs/src/iroh/magicsock/relay_actor.rs.html @@ -1787,7 +1787,13 @@ 1786 1787 1788 -1789
//! The relay actor.
+1789
+1790
+1791
+1792
+1793
+1794
+1795
//! The relay actor.
 //!
 //! The [`RelayActor`] handles all the relay connections.  It is helped by the
 //! [`ActiveRelayActor`] which handles a single relay connection.
@@ -2593,7 +2599,9 @@
     relay_datagrams_recv: &RelayDatagramRecvQueue,
     relay_disco_recv: &mut mpsc::Sender<RelayDiscoMessage>,
 ) {
-    let Some(ref mut pending) = maybe_pending else {
+    // We take a mutable reference onto the inner value.
+    // we're not `take`ing it here, because this would make the function not cancellation safe.
+    let Some(ref mut pending) = maybe_pending else {
         return;
     };
     let disco_permit = match pending.blocked_on {
@@ -2610,7 +2618,11 @@
             Some(permit)
         }
     };
-    let pending = maybe_pending.take().unwrap();
+    // We now take the inner value by value. it is cancellation safe here because
+    // no further `await`s occur after here.
+    // The unwrap is guaranteed to be safe because we checked above that it is not none.
+    #[allow(clippy::unwrap_used, reason = "checked above")]
+    let pending = maybe_pending.take().unwrap();
     if let Some(pending) = handle_received_packet_iter(
         pending.packet_iter,
         disco_permit,