@@ -583,14 +583,12 @@ pub(crate) mod futures_util {
583583 C : Future < Output = ( ) > + Unpin ,
584584 D : Future < Output = ( ) > + Unpin ,
585585 E : Future < Output = bool > + Unpin ,
586- F : Future < Output = bool > + Unpin ,
587586 > {
588587 pub a : A ,
589588 pub b : B ,
590589 pub c : C ,
591590 pub d : D ,
592591 pub e : E ,
593- pub f : F ,
594592 }
595593
596594 pub ( crate ) enum SelectorOutput {
@@ -599,7 +597,6 @@ pub(crate) mod futures_util {
599597 C ,
600598 D ,
601599 E ( bool ) ,
602- F ( bool ) ,
603600 }
604601
605602 impl <
@@ -608,8 +605,7 @@ pub(crate) mod futures_util {
608605 C : Future < Output = ( ) > + Unpin ,
609606 D : Future < Output = ( ) > + Unpin ,
610607 E : Future < Output = bool > + Unpin ,
611- F : Future < Output = bool > + Unpin ,
612- > Future for Selector < A , B , C , D , E , F >
608+ > Future for Selector < A , B , C , D , E >
613609 {
614610 type Output = SelectorOutput ;
615611 fn poll (
@@ -645,12 +641,6 @@ pub(crate) mod futures_util {
645641 } ,
646642 Poll :: Pending => { } ,
647643 }
648- match Pin :: new ( & mut self . f ) . poll ( ctx) {
649- Poll :: Ready ( res) => {
650- return Poll :: Ready ( SelectorOutput :: F ( res) ) ;
651- } ,
652- Poll :: Pending => { } ,
653- }
654644 Poll :: Pending
655645 }
656646 }
@@ -990,30 +980,27 @@ where
990980 } else {
991981 OptionalSelector { optional_future: None }
992982 } ;
983+
984+ let needs_processing = channel_manager. get_cm( ) . needs_pending_htlc_processing( ) ;
985+ let sleep_delay = match ( needs_processing, mobile_interruptable_platform) {
986+ ( true , true ) => batch_delay. get( ) . min( Duration :: from_millis( 100 ) ) ,
987+ ( true , false ) => batch_delay. get( ) . min( FASTEST_TIMER ) ,
988+ ( false , true ) => Duration :: from_millis( 100 ) ,
989+ ( false , false ) => FASTEST_TIMER ,
990+ } ;
991+
993992 let fut = Selector {
994993 a: channel_manager. get_cm( ) . get_event_or_persistence_needed_future( ) ,
995994 b: chain_monitor. get_update_future( ) ,
996995 c: om_fut,
997996 d: lm_fut,
998- e: sleeper( if channel_manager. get_cm( ) . needs_pending_htlc_processing( ) {
999- batch_delay. get( )
1000- } else {
1001- Duration :: MAX
1002- } ) ,
1003- f: sleeper( if mobile_interruptable_platform {
1004- Duration :: from_millis( 100 )
1005- } else {
1006- FASTEST_TIMER
1007- } ) ,
997+ e: sleeper( sleep_delay) ,
1008998 } ;
1009999 match fut. await {
10101000 SelectorOutput :: A | SelectorOutput :: B | SelectorOutput :: C | SelectorOutput :: D => { } ,
10111001 SelectorOutput :: E ( exit) => {
10121002 should_break = exit;
10131003 } ,
1014- SelectorOutput :: F ( exit) => {
1015- should_break = exit;
1016- } ,
10171004 }
10181005 } ,
10191006 |t| sleeper( t) ,
0 commit comments