X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fpeer_handler.rs;h=eef4054b34ad794048dd3970e96471fdb6f931c2;hb=cb1d795559611929264a1f5fa16a76283df5f2b4;hp=b910d4bf7798135ec08d8e84fc550fb907e318fb;hpb=dfc93b434129b832932b671250ff20a113430efb;p=rust-lightning diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index b910d4bf..eef4054b 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -69,7 +69,7 @@ impl RoutingMessageHandler for IgnoringMessageHandler { fn get_next_channel_announcements(&self, _starting_point: u64, _batch_amount: u8) -> Vec<(msgs::ChannelAnnouncement, Option, Option)> { Vec::new() } fn get_next_node_announcements(&self, _starting_point: Option<&PublicKey>, _batch_amount: u8) -> Vec { Vec::new() } - fn sync_routing_table(&self, _their_node_id: &PublicKey, _init: &msgs::Init) {} + fn peer_connected(&self, _their_node_id: &PublicKey, _init: &msgs::Init) {} fn handle_reply_channel_range(&self, _their_node_id: &PublicKey, _msg: msgs::ReplyChannelRange) -> Result<(), LightningError> { Ok(()) } fn handle_reply_short_channel_ids_end(&self, _their_node_id: &PublicKey, _msg: msgs::ReplyShortChannelIdsEnd) -> Result<(), LightningError> { Ok(()) } fn handle_query_channel_range(&self, _their_node_id: &PublicKey, _msg: msgs::QueryChannelRange) -> Result<(), LightningError> { Ok(()) } @@ -307,12 +307,12 @@ const OUTBOUND_BUFFER_LIMIT_DROP_GOSSIP: usize = OUTBOUND_BUFFER_LIMIT_READ_PAUS /// Thus, to avoid needlessly disconnecting a peer, we allow a peer to take this many timer ticks /// per connected peer to respond to a ping, as long as they send us at least one message during /// each tick, ensuring we aren't actually just disconnected. -/// With a timer tick interval of five seconds, this translates to about 30 seconds per connected +/// With a timer tick interval of ten seconds, this translates to about 40 seconds per connected /// peer. /// /// When we improve parallelism somewhat we should reduce this to e.g. this many timer ticks per /// two connected peers, assuming most LDK-running systems have at least two cores. -const MAX_BUFFER_DRAIN_TICK_INTERVALS_PER_PEER: i8 = 6; +const MAX_BUFFER_DRAIN_TICK_INTERVALS_PER_PEER: i8 = 4; /// This is the minimum number of messages we expect a peer to be able to handle within one timer /// tick. Once we have sent this many messages since the last ping, we send a ping right away to @@ -376,6 +376,8 @@ struct PeerHolder { /// lifetimes). Other times you can afford a reference, which is more efficient, in which case /// SimpleRefPeerManager is the more appropriate type. Defining these type aliases prevents /// issues such as overly long function definitions. +/// +/// (C-not exported) as Arcs don't make sense in bindings pub type SimpleArcPeerManager = PeerManager>, Arc, Arc, Arc>>, Arc, Arc>; /// SimpleRefPeerManager is a type alias for a PeerManager reference, and is the reference @@ -384,6 +386,8 @@ pub type SimpleArcPeerManager = PeerManager = PeerManager, &'e NetGraphMsgHandler<&'g NetworkGraph, &'h C, &'f L>, &'f L, IgnoringMessageHandler>; /// A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls @@ -1018,7 +1022,7 @@ impl P return Err(PeerHandleError{ no_connection_possible: true }.into()); } - self.message_handler.route_handler.sync_routing_table(&peer.their_node_id.unwrap(), &msg); + self.message_handler.route_handler.peer_connected(&peer.their_node_id.unwrap(), &msg); self.message_handler.chan_handler.peer_connected(&peer.their_node_id.unwrap(), &msg); peer.their_features = Some(msg.features); @@ -1477,6 +1481,9 @@ impl P msg.sync_complete); self.enqueue_message(get_peer_for_forwarding!(node_id), msg); } + MessageSendEvent::SendGossipTimestampFilter { ref node_id, ref msg } => { + self.enqueue_message(get_peer_for_forwarding!(node_id), msg); + } } } @@ -1572,9 +1579,9 @@ impl P /// Send pings to each peer and disconnect those which did not respond to the last round of /// pings. /// - /// This may be called on any timescale you want, however, roughly once every five to ten - /// seconds is preferred. The call rate determines both how often we send a ping to our peers - /// and how much time they have to respond before we disconnect them. + /// This may be called on any timescale you want, however, roughly once every ten seconds is + /// preferred. The call rate determines both how often we send a ping to our peers and how much + /// time they have to respond before we disconnect them. /// /// May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy /// issues!