From 057c62962955224428dfc878b27b7ced6108b307 Mon Sep 17 00:00:00 2001 From: woodser Date: Sun, 1 Oct 2023 11:27:45 -0400 Subject: [PATCH] connectionService.getRefreshPeriodMs() is always positive, add docs --- .../haveno/core/api/CoreMoneroConnectionsService.java | 8 ++------ .../haveno/core/xmr/model/EncryptedConnectionList.java | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/haveno/core/api/CoreMoneroConnectionsService.java b/core/src/main/java/haveno/core/api/CoreMoneroConnectionsService.java index 3390867d63..e316901ea7 100644 --- a/core/src/main/java/haveno/core/api/CoreMoneroConnectionsService.java +++ b/core/src/main/java/haveno/core/api/CoreMoneroConnectionsService.java @@ -251,11 +251,7 @@ public final class CoreMoneroConnectionsService { } public long getRefreshPeriodMs() { - if (connectionList.getRefreshPeriod() < 0 || connectionList.getRefreshPeriod() > 0) { - return connectionList.getRefreshPeriod(); - } else { - return getDefaultRefreshPeriodMs(); - } + return connectionList.getRefreshPeriod() > 0 ? connectionList.getRefreshPeriod() : getDefaultRefreshPeriodMs(); } public void verifyConnection() { @@ -526,7 +522,7 @@ public final class CoreMoneroConnectionsService { new Thread(() -> { synchronized (lock) { stopPolling(); - if (getRefreshPeriodMs() > 0) startPolling(); + if (connectionList.getRefreshPeriod() >= 0) startPolling(); // 0 means default refresh poll } }).start(); } diff --git a/core/src/main/java/haveno/core/xmr/model/EncryptedConnectionList.java b/core/src/main/java/haveno/core/xmr/model/EncryptedConnectionList.java index 9ace577e6b..b5bd7e916f 100644 --- a/core/src/main/java/haveno/core/xmr/model/EncryptedConnectionList.java +++ b/core/src/main/java/haveno/core/xmr/model/EncryptedConnectionList.java @@ -62,7 +62,7 @@ public class EncryptedConnectionList implements PersistableEnvelope, PersistedDa private final Map items = new HashMap<>(); private @NonNull String currentConnectionUrl = ""; - private long refreshPeriod; + private long refreshPeriod; // -1 means no refresh, 0 means default, >0 means custom private boolean autoSwitch; @Inject