@@ -476,11 +476,11 @@ pub(crate) mod futures_util {
476476 use core:: pin:: Pin ;
477477 use core:: task:: { Poll , RawWaker , RawWakerVTable , Waker } ;
478478 pub ( crate ) struct Selector <
479- A : Future < Output = ( ) > + Unpin ,
479+ A : Future < Output = bool > + Unpin ,
480480 B : Future < Output = ( ) > + Unpin ,
481481 C : Future < Output = ( ) > + Unpin ,
482482 D : Future < Output = ( ) > + Unpin ,
483- E : Future < Output = bool > + Unpin ,
483+ E : Future < Output = ( ) > + Unpin ,
484484 > {
485485 pub a : A ,
486486 pub b : B ,
@@ -490,19 +490,19 @@ pub(crate) mod futures_util {
490490 }
491491
492492 pub ( crate ) enum SelectorOutput {
493- A ,
493+ A ( bool ) ,
494494 B ,
495495 C ,
496496 D ,
497- E ( bool ) ,
497+ E ,
498498 }
499499
500500 impl <
501- A : Future < Output = ( ) > + Unpin ,
501+ A : Future < Output = bool > + Unpin ,
502502 B : Future < Output = ( ) > + Unpin ,
503503 C : Future < Output = ( ) > + Unpin ,
504504 D : Future < Output = ( ) > + Unpin ,
505- E : Future < Output = bool > + Unpin ,
505+ E : Future < Output = ( ) > + Unpin ,
506506 > Future for Selector < A , B , C , D , E >
507507 {
508508 type Output = SelectorOutput ;
@@ -511,15 +511,9 @@ pub(crate) mod futures_util {
511511 ) -> Poll < SelectorOutput > {
512512 // Bias the selector so it first polls the sleeper future, allowing to exit immediately
513513 // if the flag is set.
514- match Pin :: new ( & mut self . e ) . poll ( ctx) {
515- Poll :: Ready ( res) => {
516- return Poll :: Ready ( SelectorOutput :: E ( res) ) ;
517- } ,
518- Poll :: Pending => { } ,
519- }
520514 match Pin :: new ( & mut self . a ) . poll ( ctx) {
521- Poll :: Ready ( ( ) ) => {
522- return Poll :: Ready ( SelectorOutput :: A ) ;
515+ Poll :: Ready ( res ) => {
516+ return Poll :: Ready ( SelectorOutput :: A ( res ) ) ;
523517 } ,
524518 Poll :: Pending => { } ,
525519 }
@@ -541,6 +535,12 @@ pub(crate) mod futures_util {
541535 } ,
542536 Poll :: Pending => { } ,
543537 }
538+ match Pin :: new ( & mut self . e ) . poll ( ctx) {
539+ Poll :: Ready ( ( ) ) => {
540+ return Poll :: Ready ( SelectorOutput :: E ) ;
541+ } ,
542+ Poll :: Pending => { } ,
543+ }
544544 Poll :: Pending
545545 }
546546 }
@@ -1039,15 +1039,15 @@ where
10391039 ( false , false ) => FASTEST_TIMER ,
10401040 } ;
10411041 let fut = Selector {
1042- a : channel_manager . get_cm ( ) . get_event_or_persistence_needed_future ( ) ,
1043- b : chain_monitor . get_update_future ( ) ,
1044- c : om_fut ,
1045- d : lm_fut ,
1046- e : sleeper ( sleep_delay ) ,
1042+ a : sleeper ( sleep_delay ) ,
1043+ b : channel_manager . get_cm ( ) . get_event_or_persistence_needed_future ( ) ,
1044+ c : chain_monitor . get_update_future ( ) ,
1045+ d : om_fut ,
1046+ e : lm_fut ,
10471047 } ;
10481048 match fut. await {
1049- SelectorOutput :: A | SelectorOutput :: B | SelectorOutput :: C | SelectorOutput :: D => { } ,
1050- SelectorOutput :: E ( exit) => {
1049+ SelectorOutput :: B | SelectorOutput :: C | SelectorOutput :: D | SelectorOutput :: E => { } ,
1050+ SelectorOutput :: A ( exit) => {
10511051 if exit {
10521052 break ;
10531053 }
0 commit comments