@@ -35,7 +35,7 @@ use std::time::{Duration, Instant};
3535use std:: ops:: Deref ;
3636
3737#[ cfg( feature = "futures" ) ]
38- use futures :: { select , future:: FutureExt } ;
38+ use futures_util :: { select_biased , future:: FutureExt } ;
3939
4040/// `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
4141/// Rust-Lightning running properly, and (2) either can or should be run in the background. Its
@@ -378,14 +378,15 @@ pub async fn process_events_async<
378378 Descriptor : ' static + SocketDescriptor + Send + Sync ,
379379 CMH : ' static + Deref + Send + Sync ,
380380 RMH : ' static + Deref + Send + Sync ,
381+ OMH : ' static + Deref + Send + Sync ,
381382 EH : ' static + EventHandler + Send ,
382383 PS : ' static + Deref + Send ,
383384 M : ' static + Deref < Target = ChainMonitor < Signer , CF , T , F , L , P > > + Send + Sync ,
384385 CM : ' static + Deref < Target = ChannelManager < Signer , CW , T , K , F , L > > + Send + Sync ,
385386 PGS : ' static + Deref < Target = P2PGossipSync < G , CA , L > > + Send + Sync ,
386387 RGS : ' static + Deref < Target = RapidGossipSync < G , L > > + Send ,
387388 UMH : ' static + Deref + Send + Sync ,
388- PM : ' static + Deref < Target = PeerManager < Descriptor , CMH , RMH , L , UMH > > + Send + Sync ,
389+ PM : ' static + Deref < Target = PeerManager < Descriptor , CMH , RMH , OMH , L , UMH > > + Send + Sync ,
389390 S : ' static + Deref < Target = SC > + Send + Sync ,
390391 SC : WriteableScore < ' a > ,
391392 SleepFuture : core:: future:: Future < Output = bool > ,
@@ -405,14 +406,15 @@ where
405406 L :: Target : ' static + Logger ,
406407 P :: Target : ' static + Persist < Signer > ,
407408 CMH :: Target : ' static + ChannelMessageHandler ,
409+ OMH :: Target : ' static + OnionMessageHandler ,
408410 RMH :: Target : ' static + RoutingMessageHandler ,
409411 UMH :: Target : ' static + CustomMessageHandler ,
410412 PS :: Target : ' static + Persister < ' a , Signer , CW , T , K , F , L , SC > ,
411413{
412414 let mut should_continue = true ;
413415 define_run_body ! ( persister, event_handler, chain_monitor, channel_manager,
414416 gossip_sync, peer_manager, logger, scorer, should_continue, {
415- select ! {
417+ select_biased ! {
416418 _ = channel_manager. get_persistable_update_future( ) . fuse( ) => true ,
417419 cont = sleeper( Duration :: from_millis( 100 ) ) . fuse( ) => {
418420 should_continue = cont;
0 commit comments