From 6ac08e0929a38cd6fe8987c948e3b941f848656a Mon Sep 17 00:00:00 2001 From: zzz <zzz@i2pmail.org> Date: Wed, 8 Feb 2023 08:58:22 -0500 Subject: [PATCH] Tunnels: Load RIs more efficiently in peer selector --- .../src/net/i2p/router/tunnel/pool/ConnectChecker.java | 4 ++-- .../net/i2p/router/tunnel/pool/TunnelPeerSelector.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/router/java/src/net/i2p/router/tunnel/pool/ConnectChecker.java b/router/java/src/net/i2p/router/tunnel/pool/ConnectChecker.java index 3d767659ac..a56091b5b8 100644 --- a/router/java/src/net/i2p/router/tunnel/pool/ConnectChecker.java +++ b/router/java/src/net/i2p/router/tunnel/pool/ConnectChecker.java @@ -84,10 +84,10 @@ public class ConnectChecker { boolean ust = to.equals(us); if (ust && ctx.commSystem().isEstablished(from)) return true; - RouterInfo rt = ctx.netDb().lookupRouterInfoLocally(to); + RouterInfo rt = (RouterInfo) ctx.netDb().lookupLocallyWithoutValidation(to); if (rt == null) return true; - RouterInfo rf = ctx.netDb().lookupRouterInfoLocally(from); + RouterInfo rf = (RouterInfo) ctx.netDb().lookupLocallyWithoutValidation(from); if (rf == null) return true; int ct; diff --git a/router/java/src/net/i2p/router/tunnel/pool/TunnelPeerSelector.java b/router/java/src/net/i2p/router/tunnel/pool/TunnelPeerSelector.java index 8491270f42..b1124445b5 100644 --- a/router/java/src/net/i2p/router/tunnel/pool/TunnelPeerSelector.java +++ b/router/java/src/net/i2p/router/tunnel/pool/TunnelPeerSelector.java @@ -227,7 +227,7 @@ public abstract class TunnelPeerSelector extends ConnectChecker { if (ctx.commSystem().wasUnreachable(h)) return true; - RouterInfo info = ctx.netDb().lookupRouterInfoLocally(h); + RouterInfo info = (RouterInfo) ctx.netDb().lookupLocallyWithoutValidation(h); if (info == null) return true; @@ -267,7 +267,7 @@ public abstract class TunnelPeerSelector extends ConnectChecker { * @since 0.9.34, protected since 0.9.58 for ClientPeerSelector */ protected boolean allowAsOBEP(Hash h) { - RouterInfo ri = ctx.netDb().lookupRouterInfoLocally(h); + RouterInfo ri = (RouterInfo) ctx.netDb().lookupLocallyWithoutValidation(h); if (ri == null) return true; return canConnect(ri, ANY_V4); @@ -284,7 +284,7 @@ public abstract class TunnelPeerSelector extends ConnectChecker { * @since 0.9.34, protected since 0.9.58 for ClientPeerSelector */ protected boolean allowAsIBGW(Hash h) { - RouterInfo ri = ctx.netDb().lookupRouterInfoLocally(h); + RouterInfo ri = (RouterInfo) ctx.netDb().lookupLocallyWithoutValidation(h); if (ri == null) return true; if (ri.getCapabilities().indexOf(Router.CAPABILITY_REACHABLE) < 0) @@ -675,7 +675,7 @@ public abstract class TunnelPeerSelector extends ConnectChecker { if (ctx.commSystem().isEstablished(h)) return false; boolean canConnect; - RouterInfo peer = ctx.netDb().lookupRouterInfoLocally(h); + RouterInfo peer = (RouterInfo) ctx.netDb().lookupLocallyWithoutValidation(h); if (peer == null) { canConnect = false; } else if (isIn) { -- GitLab