Suggest faster ping in `PeerManager::timer_tick_occurred` docs
authorMatt Corallo <git@bluematt.me>
Wed, 4 Aug 2021 16:21:36 +0000 (16:21 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 9 Aug 2021 18:11:19 +0000 (18:11 +0000)
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.

lightning/src/ln/peer_handler.rs

index be12a32e99e5737ffa1a96236d269a917add4a14..42b2694111f1c27764a0dc78b150178d5cb14458 100644 (file)
@@ -1372,9 +1372,12 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref> PeerManager<D
                }
        }
 
-       /// This function should be called roughly once every 30 seconds.
-       /// It will send pings to each peer and disconnect those which did not respond to the last
-       /// round of pings.
+       /// 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.
        ///
        /// May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
        /// issues!