From: Matt Corallo Date: Fri, 28 Apr 2023 16:19:04 +0000 (+0000) Subject: Fix overflow in `awaiting_pong_timer...` with too many peers X-Git-Tag: v0.0.116-alpha1~60^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=fa33f98a4258e2f748bf200b8f05b8e9312f37f9;p=rust-lightning Fix overflow in `awaiting_pong_timer...` with too many peers If we have more than 127 / `MAX_BUFFER_DRAIN_TICK_INTERVALS_PER_PEER` (31) peers, `awaiting_pong_timer_tick_intervals` can overflow before we hit the limit. This isn't super harmful, we'll still disconnect peers as long as they don't send *any* messages between two pings, but it does cause us to not disconnect peers which are extremely slow in responding to messages, e.g. because they are overloaded. --- diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index 84870143..040ccc65 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -416,7 +416,7 @@ struct Peer { sync_status: InitSyncTracker, msgs_sent_since_pong: usize, - awaiting_pong_timer_tick_intervals: i8, + awaiting_pong_timer_tick_intervals: i64, received_message_since_timer_tick: bool, sent_gossip_timestamp_filter: bool,