From 65af08901ea1993109baa9684575f733b174a2df Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 26 Oct 2021 01:32:42 +0000 Subject: [PATCH] f check in a better order to allow for further changes easier --- lightning/src/ln/peer_handler.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index b082bdbe6..3d1540a94 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -1544,6 +1544,13 @@ impl P } } + if peer.awaiting_pong_tick_intervals == -1 { + // Magic value set in `maybe_send_extra_ping`. + peer.awaiting_pong_tick_intervals = 1; + peer.received_message_since_timer_tick = false; + return true; + } + if do_disconnect_peer || (peer.awaiting_pong_timertick_intervals > 0 && !peer.received_message_since_timer_tick) || peer.awaiting_pong_timertick_intervals as u64 > @@ -1560,13 +1567,7 @@ impl P } return false; } - peer.received_message_since_timer_tick = false; - if peer.awaiting_pong_timer_tick_intervals == -1 { - // Magic value set in `maybe_send_extra_ping`. - peer.awaiting_pong_timer_tick_intervals = 1; - return true; - } if peer.awaiting_pong_timer_tick_intervals > 0 { peer.awaiting_pong_timer_tick_intervals += 1; -- 2.39.5