@@ -43,7 +43,8 @@ use ln::peers::transport::{PayloadQueuer, Transport};
43
43
use bitcoin:: hashes:: core:: iter:: Filter ;
44
44
use std:: collections:: hash_map:: IterMut ;
45
45
46
- const MSG_BUFF_SIZE : usize = 10 ;
46
+ // Number of items that can exist in the OutboundQueue before Sync message flow control is triggered
47
+ const OUTBOUND_QUEUE_SIZE : usize = 10 ;
47
48
48
49
/// Interface PeerManager uses to interact with the Transport object
49
50
pub ( super ) trait ITransport : MessageQueuer {
@@ -65,7 +66,7 @@ pub(super) trait ITransport: MessageQueuer {
65
66
/// Returns the node_id of the remote node. Panics if not connected.
66
67
fn get_their_node_id ( & self ) -> PublicKey ;
67
68
68
- /// Returns all Messages that have been received and can be parsed by the Transport
69
+ /// Returns all Messages that have been received and can be successfully parsed by the Transport
69
70
fn drain_messages < L : Deref > ( & mut self , logger : L ) -> Result < Vec < Message > , PeerHandleError > where L :: Target : Logger ;
70
71
}
71
72
@@ -77,7 +78,8 @@ pub(super) trait MessageQueuer {
77
78
fn enqueue_message < M : Encode + Writeable , Q : PayloadQueuer , L : Deref > ( & mut self , message : & M , output_buffer : & mut Q , logger : L ) where L :: Target : Logger ;
78
79
}
79
80
80
- /// Trait representing a container that can try to flush data through a SocketDescriptor
81
+ /// Trait representing a container that can try to flush data through a SocketDescriptor. Used by the
82
+ /// PeerManager to handle flushing the outbound queue and flow control.
81
83
pub ( super ) trait SocketDescriptorFlusher {
82
84
/// Write previously enqueued data to the SocketDescriptor. A return of false indicates the
83
85
/// underlying SocketDescriptor could not fulfill the send_data() call and the blocked state
@@ -198,7 +200,7 @@ impl<TransportImpl: ITransport> Peer<TransportImpl> {
198
200
fn new ( outbound : bool , transport : TransportImpl ) -> Self {
199
201
Self {
200
202
outbound,
201
- outbound_queue : OutboundQueue :: new ( MSG_BUFF_SIZE ) ,
203
+ outbound_queue : OutboundQueue :: new ( OUTBOUND_QUEUE_SIZE ) ,
202
204
post_init_state : None ,
203
205
transport
204
206
}
0 commit comments