From: Matt Corallo Date: Tue, 26 Oct 2021 01:32:42 +0000 (+0000) Subject: f check in a better order to allow for further changes easier X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=65af08901ea1993109baa9684575f733b174a2df;p=rust-lightning f check in a better order to allow for further changes easier --- 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;