From 8a77db15d5d9870c71647933a0f4d4e8d820ea4e Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Tue, 5 Feb 2019 15:39:00 +0000 Subject: [PATCH] Transport: Clean up unreachable() methods (ticket #2382) --- router/java/src/net/i2p/router/transport/TransportImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/router/java/src/net/i2p/router/transport/TransportImpl.java b/router/java/src/net/i2p/router/transport/TransportImpl.java index 422254fa51..ad6d61a9ce 100644 --- a/router/java/src/net/i2p/router/transport/TransportImpl.java +++ b/router/java/src/net/i2p/router/transport/TransportImpl.java @@ -846,10 +846,10 @@ public abstract class TransportImpl implements Transport { public void mayDisconnect(Hash peer) {} public boolean isUnreachable(Hash peer) { - long now = _context.clock().now(); synchronized (_unreachableEntries) { Long when = _unreachableEntries.get(peer); if (when == null) return false; + long now = _context.clock().now(); if (when.longValue() + UNREACHABLE_PERIOD < now) { _unreachableEntries.remove(peer); return false; @@ -910,10 +910,10 @@ public abstract class TransportImpl implements Transport { * This is NOT reset if the peer contacts us. */ public boolean wasUnreachable(Hash peer) { - long now = _context.clock().now(); synchronized (_wasUnreachableEntries) { Long when = _wasUnreachableEntries.get(peer); if (when != null) { + long now = _context.clock().now(); if (when.longValue() + WAS_UNREACHABLE_PERIOD < now) { _unreachableEntries.remove(peer); return false; -- GitLab