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/?a=commitdiff_plain;h=refs%2Fheads%2F2023-04-ping-count-overflow;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 848701430..040ccc655 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,