X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-background-processor%2Fsrc%2Flib.rs;h=27cd0663e3291f27e385787d99769553c012de80;hb=e61f3a238a70cbac87209e223b7c396108a49b97;hp=704398af2aa76b2318765b9d312504b741243068;hpb=d3c369dce713360f76c0a74552e41057576181b4;p=rust-lightning diff --git a/lightning-background-processor/src/lib.rs b/lightning-background-processor/src/lib.rs index 704398af..27cd0663 100644 --- a/lightning-background-processor/src/lib.rs +++ b/lightning-background-processor/src/lib.rs @@ -35,7 +35,7 @@ use std::time::{Duration, Instant}; use std::ops::Deref; #[cfg(feature = "futures")] -use futures::{select, future::FutureExt}; +use futures_util::{select_biased, future::FutureExt}; /// `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep /// Rust-Lightning running properly, and (2) either can or should be run in the background. Its @@ -377,7 +377,6 @@ pub async fn process_events_async< P: 'static + Deref + Send + Sync, Descriptor: 'static + SocketDescriptor + Send + Sync, CMH: 'static + Deref + Send + Sync, - CUMH: 'static + Deref + Send + Sync, RMH: 'static + Deref + Send + Sync, OMH: 'static + Deref + Send + Sync, EH: 'static + EventHandler + Send, @@ -415,7 +414,7 @@ where let mut should_continue = true; define_run_body!(persister, event_handler, chain_monitor, channel_manager, gossip_sync, peer_manager, logger, scorer, should_continue, { - select! { + select_biased! { _ = channel_manager.get_persistable_update_future().fuse() => true, cont = sleeper(Duration::from_millis(100)).fuse() => { should_continue = cont; @@ -610,7 +609,7 @@ mod tests { const EVENT_DEADLINE: u64 = 5 * FRESHNESS_TIMER; - #[derive(Clone, Eq, Hash, PartialEq)] + #[derive(Clone, Hash, PartialEq, Eq)] struct TestDescriptor{} impl SocketDescriptor for TestDescriptor { fn send_data(&mut self, _data: &[u8], _resume_read: bool) -> usize {