From f90e8a7a3964e53cca69a1e5c7e47c768f08adb6 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sat, 4 Sep 2021 19:46:46 +0000 Subject: [PATCH] Drop dup PeerManager tiemr_tick_occurred calls from NioPeerHandler We call PeerManager's timer_tick_occurred in the lightning-background-processor crate, initialized from the ChannelManagerConstructor. Prior to the use of the lightning-background-processor we'd needed to call PeerManager's timer_tick_occurred from NioPeerHandler, but we never dropped it after the switch. Thus, every ~30 seconds we'll call PeerManager::timer_tick_occurred twice in a row, disconnecting all of our peers. --- src/main/java/org/ldk/batteries/NioPeerHandler.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/main/java/org/ldk/batteries/NioPeerHandler.java b/src/main/java/org/ldk/batteries/NioPeerHandler.java index 991a6b13..faca477f 100644 --- a/src/main/java/org/ldk/batteries/NioPeerHandler.java +++ b/src/main/java/org/ldk/batteries/NioPeerHandler.java @@ -98,7 +98,6 @@ public class NioPeerHandler { /** * Constructs a new peer handler, spawning a thread to monitor for socket events. - * The background thread will call the PeerManager's timer_tick_occured() function for you on an appropriate schedule. * * @param manager The LDK PeerManager which connection data will be provided to. * @throws IOException If an internal java.nio error occurs. @@ -108,7 +107,6 @@ public class NioPeerHandler { this.selector = Selector.open(); io_thread = new Thread(() -> { ByteBuffer buf = ByteBuffer.allocate(8192); - long lastTimerTick = System.currentTimeMillis(); while (true) { try { if (IS_ANDROID) { @@ -192,10 +190,6 @@ public class NioPeerHandler { // no need to do anything here with the PeerManager. } } - if (lastTimerTick < System.currentTimeMillis() - 30 * 1000) { - peer_manager.timer_tick_occurred(); - lastTimerTick = System.currentTimeMillis(); - } peer_manager.process_events(); } }, "NioPeerHandler NIO Thread"); -- 2.39.5