Skip to content

Commit 7217c5a

Browse files
committed
Suggest faster ping in PeerManager::timer_tick_occurred docs
This clarifies the docs for `PeerManager::timer_tick_occurred` to note that the call rate is entirely up to the user, and also suggests a faster ping rate of "once every five to ten seconds" instead of "every 30 seconds". There isn't a lot of reason to want to ping less often, and faster ping means we detect disconnects sooner, which is important.
1 parent 09e1670 commit 7217c5a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lightning/src/ln/peer_handler.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,9 +1372,12 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref> PeerManager<D
13721372
}
13731373
}
13741374

1375-
/// This function should be called roughly once every 30 seconds.
1376-
/// It will send pings to each peer and disconnect those which did not respond to the last
1377-
/// round of pings.
1375+
/// Send pings to each peer and disconnect those which did not respond to the last round of
1376+
/// pings.
1377+
///
1378+
/// This may be called on any timescale you want, however, roughly once every five to ten
1379+
/// seconds is preferred. The call rate determines both how often we send a ping to our peers
1380+
/// and how long they have to respond before we disconnect them.
13781381
///
13791382
/// May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
13801383
/// issues!

0 commit comments

Comments
 (0)