@@ -503,65 +503,60 @@ pub fn create_supervisor_listener(
503
503
std:: thread:: spawn ( move || {
504
504
let rt = Runtime :: new ( ) . unwrap ( ) ;
505
505
rt. block_on ( async {
506
- loop {
507
- if let Some ( r_msg) = client_recv. next ( ) . await {
508
- trace ! ( "Message received from supervisor client" ) ;
509
- match r_msg {
510
- Ok ( msg) => match msg {
511
- TMessage :: Text ( data) => {
512
- if data == "Reset" {
513
- sender
514
- . send ( SupervisorAction :: Quit )
515
- . expect ( "Could not send SupervisorAction" ) ;
516
- break ;
517
- } else if data == "Received" {
518
- sender
519
- . send ( SupervisorAction :: Received )
520
- . expect ( "Could not send SupervisorAction" ) ;
521
- } else if data. contains ( "Map" ) || data. contains ( "map" ) {
522
- sender
523
- . send ( SupervisorAction :: Config ( data) )
524
- . expect ( "Could not send config" ) ;
525
- } else if data == "Quit" {
526
- sender
527
- . send ( SupervisorAction :: ForceQuit )
528
- . expect ( "Could not send ForceQuit" ) ;
529
- }
530
- }
531
- TMessage :: Ping ( payload) => {
506
+ while let Some ( r_msg) = client_recv. next ( ) . await {
507
+ trace ! ( "Message received from supervisor client" ) ;
508
+ match r_msg {
509
+ Ok ( msg) => match msg {
510
+ TMessage :: Text ( data) => {
511
+ if data == "Reset" {
512
+ sender
513
+ . send ( SupervisorAction :: Quit )
514
+ . expect ( "Could not send SupervisorAction" ) ;
515
+ break ;
516
+ } else if data == "Received" {
532
517
sender
533
- . send ( SupervisorAction :: Ping ( payload ) )
518
+ . send ( SupervisorAction :: Received )
534
519
. expect ( "Could not send SupervisorAction" ) ;
520
+ } else if data. contains ( "Map" ) || data. contains ( "map" ) {
521
+ sender
522
+ . send ( SupervisorAction :: Config ( data) )
523
+ . expect ( "Could not send config" ) ;
524
+ } else if data == "Quit" {
525
+ sender
526
+ . send ( SupervisorAction :: ForceQuit )
527
+ . expect ( "Could not send ForceQuit" ) ;
535
528
}
536
- _ => { }
537
- } ,
538
- Err ( Error :: AlreadyClosed ) => {
539
- error ! ( "Supervisor Error::AlreadyClosed" ) ;
540
- sender
541
- . send ( SupervisorAction :: ForceQuit )
542
- . expect ( "Could not send ForceQuit" ) ;
543
- break ;
544
529
}
545
- Err ( Error :: Capacity ( e) ) => {
546
- error ! ( "{:?}" , e) ;
530
+ TMessage :: Ping ( payload) => {
547
531
sender
548
- . send ( SupervisorAction :: ForceQuit )
549
- . expect ( "Could not send ForceQuit" ) ;
550
- break ;
551
- }
552
- Err ( e) => {
553
- error ! ( "{:?}" , e) ;
554
- sender
555
- . send ( SupervisorAction :: ForceQuit )
556
- . expect ( "Could not send ForceQuit" ) ;
557
- break ;
532
+ . send ( SupervisorAction :: Ping ( payload) )
533
+ . expect ( "Could not send SupervisorAction" ) ;
558
534
}
535
+ _ => { }
536
+ } ,
537
+ Err ( Error :: AlreadyClosed ) => {
538
+ error ! ( "Supervisor Error::AlreadyClosed" ) ;
539
+ sender
540
+ . send ( SupervisorAction :: ForceQuit )
541
+ . expect ( "Could not send ForceQuit" ) ;
542
+ break ;
543
+ }
544
+ Err ( Error :: Capacity ( e) ) => {
545
+ error ! ( "{:?}" , e) ;
546
+ sender
547
+ . send ( SupervisorAction :: ForceQuit )
548
+ . expect ( "Could not send ForceQuit" ) ;
549
+ break ;
550
+ }
551
+ Err ( e) => {
552
+ error ! ( "{:?}" , e) ;
553
+ sender
554
+ . send ( SupervisorAction :: ForceQuit )
555
+ . expect ( "Could not send ForceQuit" ) ;
556
+ break ;
559
557
}
560
- } else {
561
- break ;
562
558
}
563
559
}
564
- return ;
565
560
} ) ;
566
561
} ) ;
567
562
}
0 commit comments