@@ -140,7 +140,6 @@ pub(super) struct RemoteStateActor {
140140 //
141141 /// Metrics.
142142 metrics : Arc < MagicsockMetrics > ,
143- sender : TransportsSender ,
144143 /// Our local addresses.
145144 ///
146145 /// These are our local addresses and any reflexive transport addresses.
@@ -202,7 +201,6 @@ impl RemoteStateActor {
202201 local_direct_addrs : n0_watcher:: Direct < BTreeSet < DirectAddr > > ,
203202 relay_mapped_addrs : AddrMap < ( RelayUrl , EndpointId ) , RelayMappedAddr > ,
204203 metrics : Arc < MagicsockMetrics > ,
205- sender : TransportsSender ,
206204 discovery : ConcurrentDiscovery ,
207205 ) -> Self {
208206 Self {
@@ -222,7 +220,6 @@ impl RemoteStateActor {
222220 scheduled_holepunch : None ,
223221 scheduled_open_path : None ,
224222 pending_open_paths : VecDeque :: new ( ) ,
225- sender,
226223 discovery_stream : Either :: Left ( n0_future:: stream:: pending ( ) ) ,
227224 }
228225 }
@@ -342,8 +339,8 @@ impl RemoteStateActor {
342339 async fn handle_message ( & mut self , msg : RemoteStateMessage ) {
343340 // trace!("handling message");
344341 match msg {
345- RemoteStateMessage :: SendDatagram ( transmit) => {
346- self . handle_msg_send_datagram ( transmit) . await ;
342+ RemoteStateMessage :: SendDatagram ( sender , transmit) => {
343+ self . handle_msg_send_datagram ( sender , transmit) . await ;
347344 }
348345 RemoteStateMessage :: AddConnection ( handle, tx) => {
349346 self . handle_msg_add_connection ( handle, tx) . await ;
@@ -358,7 +355,11 @@ impl RemoteStateActor {
358355 }
359356
360357 /// Handles [`RemoteStateMessage::SendDatagram`].
361- async fn handle_msg_send_datagram ( & mut self , transmit : OwnedTransmit ) {
358+ async fn handle_msg_send_datagram (
359+ & mut self ,
360+ mut sender : TransportsSender ,
361+ transmit : OwnedTransmit ,
362+ ) {
362363 // Sending datagrams might fail, e.g. because we don't have the right transports set
363364 // up to handle sending this owned transmit to.
364365 // After all, we try every single path that we know (relay URL, IP address), even
@@ -368,7 +369,7 @@ impl RemoteStateActor {
368369 if let Some ( addr) = self . selected_path . get ( ) {
369370 trace ! ( ?addr, "sending datagram to selected path" ) ;
370371
371- if let Err ( err) = send_datagram ( & mut self . sender , addr. clone ( ) , transmit) . await {
372+ if let Err ( err) = send_datagram ( & mut sender, addr. clone ( ) , transmit) . await {
372373 debug ! ( ?addr, "failed to send datagram on selected_path: {err:#}" ) ;
373374 }
374375 } else {
@@ -392,7 +393,7 @@ impl RemoteStateActor {
392393 {
393394 trace ! ( %sockaddr, "not sending datagram to our own address" ) ;
394395 } else if let Err ( err) =
395- send_datagram ( & mut self . sender , addr. clone ( ) , transmit. clone ( ) ) . await
396+ send_datagram ( & mut sender, addr. clone ( ) , transmit. clone ( ) ) . await
396397 {
397398 debug ! ( ?addr, "failed to send datagram: {err:#}" ) ;
398399 }
@@ -996,7 +997,7 @@ pub(crate) enum RemoteStateMessage {
996997 /// operation with a bunch more copying. So it should only be used for sending QUIC
997998 /// Initial packets.
998999 #[ debug( "SendDatagram(..)" ) ]
999- SendDatagram ( OwnedTransmit ) ,
1000+ SendDatagram ( TransportsSender , OwnedTransmit ) ,
10001001 /// Adds an active connection to this remote endpoint.
10011002 ///
10021003 /// The connection will now be managed by this actor. Holepunching will happen when
0 commit comments