]> git.bitcoin.ninja Git - rust-lightning/commitdiff
f check in a better order to allow for further changes easier
authorMatt Corallo <git@bluematt.me>
Tue, 26 Oct 2021 01:32:42 +0000 (01:32 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 28 Oct 2021 18:26:10 +0000 (18:26 +0000)
lightning/src/ln/peer_handler.rs

index b082bdbe6c6bf7d4e7e50851118f8340e5aea0e7..3d1540a9419c65178105cabfca5e1a40a2ed40a5 100644 (file)
@@ -1544,6 +1544,13 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> 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<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> 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;