File tree Expand file tree Collapse file tree 3 files changed +20
-20
lines changed
Expand file tree Collapse file tree 3 files changed +20
-20
lines changed Original file line number Diff line number Diff line change 55// http://opensource.org/licenses/MIT>, at your option. You may not use this file except in
66// accordance with one or both of these licenses.
77
8- use std:: future:: Future ;
98use std:: sync:: atomic:: { AtomicU32 , Ordering } ;
109use std:: sync:: Arc ;
1110use std:: time:: Duration ;
1211
13- use lightning:: util:: native_async:: FutureSpawner ;
1412use lightning_block_sync:: gossip:: GossipVerifier ;
1513
1614use crate :: chain:: ChainSource ;
1715use crate :: config:: RGS_SYNC_TIMEOUT_SECS ;
1816use crate :: logger:: { log_trace, LdkLogger , Logger } ;
19- use crate :: runtime:: Runtime ;
17+ use crate :: runtime:: { Runtime , RuntimeSpawner } ;
2018use crate :: types:: { GossipSync , Graph , P2PGossipSync , RapidGossipSync } ;
2119use crate :: Error ;
2220
@@ -114,19 +112,3 @@ impl GossipSource {
114112 }
115113 }
116114}
117-
118- pub ( crate ) struct RuntimeSpawner {
119- runtime : Arc < Runtime > ,
120- }
121-
122- impl RuntimeSpawner {
123- pub ( crate ) fn new ( runtime : Arc < Runtime > ) -> Self {
124- Self { runtime }
125- }
126- }
127-
128- impl FutureSpawner for RuntimeSpawner {
129- fn spawn < T : Future < Output = ( ) > + Send + ' static > ( & self , future : T ) {
130- self . runtime . spawn_cancellable_background_task ( future) ;
131- }
132- }
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ use std::future::Future;
99use std:: sync:: { Arc , Mutex } ;
1010use std:: time:: Duration ;
1111
12+ use lightning:: util:: native_async:: FutureSpawner ;
13+
1214use tokio:: task:: { JoinHandle , JoinSet } ;
1315
1416use crate :: config:: {
@@ -219,3 +221,19 @@ enum RuntimeMode {
219221 Owned ( tokio:: runtime:: Runtime ) ,
220222 Handle ( tokio:: runtime:: Handle ) ,
221223}
224+
225+ pub ( crate ) struct RuntimeSpawner {
226+ runtime : Arc < Runtime > ,
227+ }
228+
229+ impl RuntimeSpawner {
230+ pub ( crate ) fn new ( runtime : Arc < Runtime > ) -> Self {
231+ Self { runtime }
232+ }
233+ }
234+
235+ impl FutureSpawner for RuntimeSpawner {
236+ fn spawn < T : Future < Output = ( ) > + Send + ' static > ( & self , future : T ) {
237+ self . runtime . spawn_cancellable_background_task ( future) ;
238+ }
239+ }
Original file line number Diff line number Diff line change @@ -35,10 +35,10 @@ use crate::chain::ChainSource;
3535use crate :: config:: ChannelConfig ;
3636use crate :: data_store:: DataStore ;
3737use crate :: fee_estimator:: OnchainFeeEstimator ;
38- use crate :: gossip:: RuntimeSpawner ;
3938use crate :: logger:: Logger ;
4039use crate :: message_handler:: NodeCustomMessageHandler ;
4140use crate :: payment:: PaymentDetails ;
41+ use crate :: runtime:: RuntimeSpawner ;
4242
4343/// A supertrait that requires that a type implements both [`KVStore`] and [`KVStoreSync`] at the
4444/// same time.
You can’t perform that action at this time.
0 commit comments