@@ -285,7 +285,7 @@ async fn tcp_wait_for_connection(listener: &mut TcpListener) -> Result<TcpStream
285285}
286286
287287pub async fn io_loop (
288- need_restart : BroadcastSender < ( ) > ,
288+ need_restart : BroadcastSender < Option < Action > > ,
289289 tcp_start : Arc < Notify > ,
290290 config : SharedConfig ,
291291 tx : Arc < Mutex < Option < Sender < Packet > > > > ,
@@ -334,7 +334,7 @@ pub async fn io_loop(
334334 error ! ( "{} 🔴 Enabling Android Auto: {}" , NAME , e) ;
335335 // notify main loop to restart
336336 if !profile_connected. load ( Ordering :: Relaxed ) {
337- let _ = need_restart. send ( ( ) ) ;
337+ let _ = need_restart. send ( None ) ;
338338 }
339339 continue ;
340340 }
@@ -355,7 +355,7 @@ pub async fn io_loop(
355355 } else {
356356 // notify main loop to restart
357357 if !profile_connected. load ( Ordering :: Relaxed ) {
358- let _ = need_restart. send ( ( ) ) ;
358+ let _ = need_restart. send ( None ) ;
359359 }
360360 continue ;
361361 }
@@ -371,7 +371,7 @@ pub async fn io_loop(
371371 } else {
372372 // notify main loop to restart
373373 if !profile_connected. load ( Ordering :: Relaxed ) {
374- let _ = need_restart. send ( ( ) ) ;
374+ let _ = need_restart. send ( None ) ;
375375 }
376376 continue ;
377377 }
@@ -392,7 +392,7 @@ pub async fn io_loop(
392392 error ! ( "{} 🔴 Error opening USB accessory: {}" , NAME , e) ;
393393 // notify main loop to restart
394394 if !profile_connected. load ( Ordering :: Relaxed ) {
395- let _ = need_restart. send ( ( ) ) ;
395+ let _ = need_restart. send ( None ) ;
396396 }
397397 continue ;
398398 }
@@ -552,8 +552,10 @@ pub async fn io_loop(
552552 NAME ,
553553 format_duration( started. elapsed( ) ) . to_string( )
554554 ) ;
555+ // obtain action for passing it to broadcast sender
556+ let action = shared_config. read ( ) . await . action_requested . clone ( ) ;
555557 // stream(s) closed, notify main loop to restart
556- let _ = need_restart. send ( ( ) ) ;
558+ let _ = need_restart. send ( action ) ;
557559 }
558560
559561 #[ allow( unreachable_code) ]
0 commit comments