Skip to content

Commit 2bba1d4

Browse files
authored
Merge pull request #1348 from TheBlueMatt/2022-03-timer-tick-count
Reduce the number of timer ticks a peer is allowed to take
2 parents eafe7d2 + 252280d commit 2bba1d4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lightning/src/ln/peer_handler.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,12 @@ const OUTBOUND_BUFFER_LIMIT_DROP_GOSSIP: usize = OUTBOUND_BUFFER_LIMIT_READ_PAUS
307307
/// Thus, to avoid needlessly disconnecting a peer, we allow a peer to take this many timer ticks
308308
/// per connected peer to respond to a ping, as long as they send us at least one message during
309309
/// each tick, ensuring we aren't actually just disconnected.
310-
/// With a timer tick interval of five seconds, this translates to about 30 seconds per connected
310+
/// With a timer tick interval of ten seconds, this translates to about 40 seconds per connected
311311
/// peer.
312312
///
313313
/// When we improve parallelism somewhat we should reduce this to e.g. this many timer ticks per
314314
/// two connected peers, assuming most LDK-running systems have at least two cores.
315-
const MAX_BUFFER_DRAIN_TICK_INTERVALS_PER_PEER: i8 = 6;
315+
const MAX_BUFFER_DRAIN_TICK_INTERVALS_PER_PEER: i8 = 4;
316316

317317
/// This is the minimum number of messages we expect a peer to be able to handle within one timer
318318
/// tick. Once we have sent this many messages since the last ping, we send a ping right away to
@@ -1572,9 +1572,9 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> P
15721572
/// Send pings to each peer and disconnect those which did not respond to the last round of
15731573
/// pings.
15741574
///
1575-
/// This may be called on any timescale you want, however, roughly once every five to ten
1576-
/// seconds is preferred. The call rate determines both how often we send a ping to our peers
1577-
/// and how much time they have to respond before we disconnect them.
1575+
/// This may be called on any timescale you want, however, roughly once every ten seconds is
1576+
/// preferred. The call rate determines both how often we send a ping to our peers and how much
1577+
/// time they have to respond before we disconnect them.
15781578
///
15791579
/// May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
15801580
/// issues!

0 commit comments

Comments
 (0)