From 79bf3c37aa391c974369499220b46943ca4075b1 Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Thu, 5 Dec 2024 13:18:41 +0100 Subject: [PATCH] refactor(iroh): Rename the relay-is-ready-to-send waker (#3014) ## Description I thought I was going to put in a queue or channel of some sort... but not yet. Still, let's rename this for now. ## Breaking Changes ## Notes & open questions ## Change checklist - [x] Self-review. - [x] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [x] Tests if relevant. - [x] All breaking changes documented. --- iroh/src/magicsock.rs | 11 +++++++---- iroh/src/magicsock/relay_actor.rs | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/iroh/src/magicsock.rs b/iroh/src/magicsock.rs index 1b08302de9..cd4c3067f2 100644 --- a/iroh/src/magicsock.rs +++ b/iroh/src/magicsock.rs @@ -187,8 +187,11 @@ pub(crate) struct MagicSock { /// [`AsyncUdpSocket`]. This queue takes care of the wakers needed by /// [`AsyncUdpSocket::poll_recv`]. relay_datagrams_queue: Arc, - - network_send_wakers: Arc>>, + /// Waker to wake the [`AsyncUdpSocket`] when more data can be sent to the relay server. + /// + /// This waker is used by [`IoPoller`] and the [`RelayActor`] to signal when more + /// datagrams can be sent to the relays. + relay_send_waker: Arc>>, /// Counter for ordering of [`MagicSock::poll_recv`] polling order. poll_recv_counter: AtomicUsize, @@ -453,7 +456,7 @@ impl MagicSock { ipv4_poller, ipv6_poller, relay_sender, - relay_send_waker: self.network_send_wakers.clone(), + relay_send_waker: self.relay_send_waker.clone(), }) } @@ -1549,7 +1552,7 @@ impl Handle { closing: AtomicBool::new(false), closed: AtomicBool::new(false), relay_datagrams_queue: relay_datagrams_queue.clone(), - network_send_wakers: Arc::new(parking_lot::Mutex::new(None)), + relay_send_waker: Arc::new(parking_lot::Mutex::new(None)), poll_recv_counter: AtomicUsize::new(0), actor_sender: actor_sender.clone(), ipv6_reported: Arc::new(AtomicBool::new(false)), diff --git a/iroh/src/magicsock/relay_actor.rs b/iroh/src/magicsock/relay_actor.rs index 662055ceec..86aed8d708 100644 --- a/iroh/src/magicsock/relay_actor.rs +++ b/iroh/src/magicsock/relay_actor.rs @@ -427,7 +427,7 @@ impl RelayActor { } // Wake up the send waker if one is waiting for space in the channel - let mut wakers = self.msock.network_send_wakers.lock(); + let mut wakers = self.msock.relay_send_waker.lock(); if let Some(waker) = wakers.take() { waker.wake(); }