From f22bf33bc7e9e2eacbce3cb8536e95930df3ab7b Mon Sep 17 00:00:00 2001 From: zzz Date: Sat, 1 Jun 2024 11:14:26 +0000 Subject: [PATCH] I2CP: Store local dest in lookup cache (Gitlab #482) --- core/java/src/net/i2p/client/impl/I2PSessionImpl.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/java/src/net/i2p/client/impl/I2PSessionImpl.java b/core/java/src/net/i2p/client/impl/I2PSessionImpl.java index 8dff24d15..ccadba047 100644 --- a/core/java/src/net/i2p/client/impl/I2PSessionImpl.java +++ b/core/java/src/net/i2p/client/impl/I2PSessionImpl.java @@ -554,6 +554,15 @@ public abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2 synchronized (_leaseSetWait) { _leaseSetWait.notifyAll(); } + // Because of netdb isolation, a b32 lookup for a local dest ("loopback") + // would force the router to fetch the LS from a floodfill. + // Putting our dest in the lookup cache where other clients can + // get it allows immediate resolution. + Destination d = ls.getDestination(); + Hash h = d.calculateHash(); + synchronized (_lookupCache) { + _lookupCache.put(h, d); + } } }