@@ -183,7 +183,7 @@ impl RemoteStateActor {
183183 }
184184 }
185185
186- pub ( super ) fn start ( mut self ) -> RemoteStateHandle {
186+ pub ( super ) fn start ( self ) -> RemoteStateHandle {
187187 let ( tx, rx) = guarded_channel ( 16 ) ;
188188 let me = self . local_endpoint_id ;
189189 let endpoint_id = self . endpoint_id ;
@@ -193,19 +193,12 @@ impl RemoteStateActor {
193193 // we don't explicitly set a span we get the spans from whatever call happens to
194194 // first create the actor, which is often very confusing as it then keeps those
195195 // spans for all logging of the actor.
196- let task = task:: spawn (
197- async move {
198- if let Err ( err) = self . run ( rx) . await {
199- error ! ( "actor failed: {err:#}" ) ;
200- }
201- }
202- . instrument ( info_span ! (
203- parent: None ,
204- "RemoteStateActor" ,
205- me = %me. fmt_short( ) ,
206- remote = %endpoint_id. fmt_short( ) ,
207- ) ) ,
208- ) ;
196+ let task = task:: spawn ( self . run ( rx) . instrument ( info_span ! (
197+ parent: None ,
198+ "RemoteStateActor" ,
199+ me = %me. fmt_short( ) ,
200+ remote = %endpoint_id. fmt_short( ) ,
201+ ) ) ) ;
209202 RemoteStateHandle {
210203 sender : tx,
211204 _task : AbortOnDropHandle :: new ( task) ,
@@ -217,10 +210,7 @@ impl RemoteStateActor {
217210 /// Note that the actor uses async handlers for tasks from the main loop. The actor is
218211 /// not processing items from the inbox while waiting on any async calls. So some
219212 /// discipline is needed to not turn pending for a long time.
220- async fn run (
221- & mut self ,
222- mut inbox : GuardedReceiver < RemoteStateMessage > ,
223- ) -> n0_error:: Result < ( ) > {
213+ async fn run ( mut self , mut inbox : GuardedReceiver < RemoteStateMessage > ) {
224214 trace ! ( "actor started" ) ;
225215 let idle_timeout = MaybeFuture :: None ;
226216 tokio:: pin!( idle_timeout) ;
@@ -239,7 +229,7 @@ impl RemoteStateActor {
239229 biased;
240230 msg = inbox. recv( ) => {
241231 match msg {
242- Some ( msg) => self . handle_message( msg) . await ? ,
232+ Some ( msg) => self . handle_message( msg) . await ,
243233 None => break ,
244234 }
245235 }
@@ -290,18 +280,19 @@ impl RemoteStateActor {
290280 }
291281 }
292282 trace ! ( "actor terminating" ) ;
293- Ok ( ( ) )
294283 }
295284
296285 /// Handles an actor message.
297286 ///
298287 /// Error returns are fatal and kill the actor.
299288 #[ instrument( skip( self ) ) ]
300- async fn handle_message ( & mut self , msg : RemoteStateMessage ) -> n0_error :: Result < ( ) > {
289+ async fn handle_message ( & mut self , msg : RemoteStateMessage ) {
301290 // trace!("handling message");
302291 match msg {
303292 RemoteStateMessage :: SendDatagram ( transmit) => {
304- self . handle_msg_send_datagram ( transmit) . await ?;
293+ if let Err ( err) = self . handle_msg_send_datagram ( transmit) . await {
294+ warn ! ( "failed to send datagram: {err:#}" ) ;
295+ }
305296 }
306297 RemoteStateMessage :: AddConnection ( handle, tx) => {
307298 self . handle_msg_add_connection ( handle, tx) . await ;
@@ -325,15 +316,13 @@ impl RemoteStateActor {
325316 self . handle_msg_latency ( tx) ;
326317 }
327318 }
328- Ok ( ( ) )
329319 }
330320
331321 async fn send_datagram (
332322 & self ,
333323 dst : transports:: Addr ,
334324 owned_transmit : OwnedTransmit ,
335325 ) -> n0_error:: Result < ( ) > {
336- debug ! ( ?dst, "send datagram" ) ;
337326 let transmit = transports:: Transmit {
338327 ecn : owned_transmit. ecn ,
339328 contents : owned_transmit. contents . as_ref ( ) ,
0 commit comments