@@ -68,7 +68,7 @@ use tokio::io::{AsyncReadExt, AsyncWrite, AsyncWriteExt};
68
68
69
69
use lightning:: ln:: peer_handler;
70
70
use lightning:: ln:: peer_handler:: SocketDescriptor as LnSocketTrait ;
71
- use lightning:: ln:: msgs:: ChannelMessageHandler ;
71
+ use lightning:: ln:: msgs:: { ChannelMessageHandler , RoutingMessageHandler } ;
72
72
73
73
use std:: { task, thread} ;
74
74
use std:: net:: SocketAddr ;
@@ -121,7 +121,9 @@ impl Connection {
121
121
_ => panic ! ( )
122
122
}
123
123
}
124
- async fn schedule_read < CMH : ChannelMessageHandler + ' static > ( peer_manager : Arc < peer_handler:: PeerManager < SocketDescriptor , Arc < CMH > > > , us : Arc < Mutex < Self > > , mut reader : io:: ReadHalf < TcpStream > , mut read_wake_receiver : mpsc:: Receiver < ( ) > , mut write_avail_receiver : mpsc:: Receiver < ( ) > ) {
124
+ async fn schedule_read < CMH , RMH > ( peer_manager : Arc < peer_handler:: PeerManager < SocketDescriptor , Arc < CMH > , Arc < RMH > > > , us : Arc < Mutex < Self > > , mut reader : io:: ReadHalf < TcpStream > , mut read_wake_receiver : mpsc:: Receiver < ( ) > , mut write_avail_receiver : mpsc:: Receiver < ( ) > ) where
125
+ CMH : ChannelMessageHandler + ' static ,
126
+ RMH : RoutingMessageHandler + ' static {
125
127
let peer_manager_ref = peer_manager. clone ( ) ;
126
128
// 8KB is nice and big but also should never cause any issues with stack overflowing.
127
129
let mut buf = [ 0 ; 8192 ] ;
@@ -231,7 +233,9 @@ impl Connection {
231
233
/// not need to poll the provided future in order to make progress.
232
234
///
233
235
/// See the module-level documentation for how to handle the event_notify mpsc::Sender.
234
- pub fn setup_inbound < CMH : ChannelMessageHandler + ' static > ( peer_manager : Arc < peer_handler:: PeerManager < SocketDescriptor , Arc < CMH > > > , event_notify : mpsc:: Sender < ( ) > , stream : TcpStream ) -> impl std:: future:: Future < Output =( ) > {
236
+ pub fn setup_inbound < CMH , RMH > ( peer_manager : Arc < peer_handler:: PeerManager < SocketDescriptor , Arc < CMH > , Arc < RMH > > > , event_notify : mpsc:: Sender < ( ) > , stream : TcpStream ) -> impl std:: future:: Future < Output =( ) > where
237
+ CMH : ChannelMessageHandler + ' static ,
238
+ RMH : RoutingMessageHandler + ' static {
235
239
let ( reader, write_receiver, read_receiver, us) = Connection :: new ( event_notify, stream) ;
236
240
#[ cfg( debug_assertions) ]
237
241
let last_us = Arc :: clone ( & us) ;
@@ -270,7 +274,9 @@ pub fn setup_inbound<CMH: ChannelMessageHandler + 'static>(peer_manager: Arc<pee
270
274
/// not need to poll the provided future in order to make progress.
271
275
///
272
276
/// See the module-level documentation for how to handle the event_notify mpsc::Sender.
273
- pub fn setup_outbound < CMH : ChannelMessageHandler + ' static > ( peer_manager : Arc < peer_handler:: PeerManager < SocketDescriptor , Arc < CMH > > > , event_notify : mpsc:: Sender < ( ) > , their_node_id : PublicKey , stream : TcpStream ) -> impl std:: future:: Future < Output =( ) > {
277
+ pub fn setup_outbound < CMH , RMH > ( peer_manager : Arc < peer_handler:: PeerManager < SocketDescriptor , Arc < CMH > , Arc < RMH > > > , event_notify : mpsc:: Sender < ( ) > , their_node_id : PublicKey , stream : TcpStream ) -> impl std:: future:: Future < Output =( ) > where
278
+ CMH : ChannelMessageHandler + ' static ,
279
+ RMH : RoutingMessageHandler + ' static {
274
280
let ( reader, mut write_receiver, read_receiver, us) = Connection :: new ( event_notify, stream) ;
275
281
#[ cfg( debug_assertions) ]
276
282
let last_us = Arc :: clone ( & us) ;
@@ -339,7 +345,9 @@ pub fn setup_outbound<CMH: ChannelMessageHandler + 'static>(peer_manager: Arc<pe
339
345
/// make progress.
340
346
///
341
347
/// See the module-level documentation for how to handle the event_notify mpsc::Sender.
342
- pub async fn connect_outbound < CMH : ChannelMessageHandler + ' static > ( peer_manager : Arc < peer_handler:: PeerManager < SocketDescriptor , Arc < CMH > > > , event_notify : mpsc:: Sender < ( ) > , their_node_id : PublicKey , addr : SocketAddr ) -> Option < impl std:: future:: Future < Output =( ) > > {
348
+ pub async fn connect_outbound < CMH , RMH > ( peer_manager : Arc < peer_handler:: PeerManager < SocketDescriptor , Arc < CMH > , Arc < RMH > > > , event_notify : mpsc:: Sender < ( ) > , their_node_id : PublicKey , addr : SocketAddr ) -> Option < impl std:: future:: Future < Output =( ) > > where
349
+ CMH : ChannelMessageHandler + ' static ,
350
+ RMH : RoutingMessageHandler + ' static {
343
351
if let Ok ( Ok ( stream) ) = time:: timeout ( Duration :: from_secs ( 10 ) , TcpStream :: connect ( & addr) ) . await {
344
352
Some ( setup_outbound ( peer_manager, event_notify, their_node_id, stream) )
345
353
} else { None }
@@ -565,7 +573,7 @@ mod tests {
565
573
} ) ;
566
574
let a_manager = Arc :: new ( PeerManager :: new ( MessageHandler {
567
575
chan_handler : Arc :: clone ( & a_handler) ,
568
- route_handler : Arc :: clone ( & a_handler) as Arc < dyn RoutingMessageHandler > ,
576
+ route_handler : Arc :: clone ( & a_handler) ,
569
577
} , a_key. clone ( ) , & [ 1 ; 32 ] , Arc :: new ( TestLogger ( ) ) ) ) ;
570
578
571
579
let ( b_connected_sender, mut b_connected) = mpsc:: channel ( 1 ) ;
@@ -578,7 +586,7 @@ mod tests {
578
586
} ) ;
579
587
let b_manager = Arc :: new ( PeerManager :: new ( MessageHandler {
580
588
chan_handler : Arc :: clone ( & b_handler) ,
581
- route_handler : Arc :: clone ( & b_handler) as Arc < dyn RoutingMessageHandler > ,
589
+ route_handler : Arc :: clone ( & b_handler) ,
582
590
} , b_key. clone ( ) , & [ 2 ; 32 ] , Arc :: new ( TestLogger ( ) ) ) ) ;
583
591
584
592
// We bind on localhost, hoping the environment is properly configured with a local
0 commit comments