Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
- reject too old seeds - do not store the complete seed in the reverse name cache, only the hash of the peer
orbiterc852d2d70e25
diff --git a/source/de/anomic/yacy/yacyPeerActions.java b/source/de/anomic/yacy/yacyPeerActions.javaindex 0a1232fd7..d156679f0 100644--- a/source/de/anomic/yacy/yacyPeerActions.java+++ b/source/de/anomic/yacy/yacyPeerActions.java@@ -105,7 +105,7 @@ public class yacyPeerActions {ctimeUTC0 = nowUTC0Time;assert (seed.getLastSeenUTC() - ctimeUTC0 < 100);}- if (Math.abs(nowUTC0Time - ctimeUTC0) > 60 * 60 * 24 * 1000) {+ if (Math.abs(nowUTC0Time - ctimeUTC0) > 60 * 60 * 12 * 1000) {// the new connection is out-of-age, we reject the connectionif (yacyCore.log.isFine()) yacyCore.log.logFine("connect: rejecting out-dated peer '" + seed.getName() + "' from " + seed.getPublicAddress() + "; nowUTC0=" + nowUTC0Time + ", seedUTC0=" + ctimeUTC0 + ", TimeDiff=" + DateFormatter.formatInterval(Math.abs(nowUTC0Time - ctimeUTC0)));return false;diff --git a/source/de/anomic/yacy/yacySeedDB.java b/source/de/anomic/yacy/yacySeedDB.javaindex b5fc0ebde..fe0919627 100644--- a/source/de/anomic/yacy/yacySeedDB.java+++ b/source/de/anomic/yacy/yacySeedDB.java@@ -100,7 +100,7 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {private yacySeed mySeed; // my own seed- private final Hashtable<String, yacySeed> nameLookupCache;+ private final Hashtable<String, String> nameLookupCache; // a name-to-hash relationprivate final Hashtable<InetAddress, SoftReference<yacySeed>> ipLookupCache;public yacySeedDB(@@ -125,7 +125,7 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {seedPotentialDB = openSeedTable(seedPotentialDBFile);// start our virtual DNS service for yacy peers with empty cache- nameLookupCache = new Hashtable<String, yacySeed>();+ nameLookupCache = new Hashtable<String, String>();// cache for reverse name lookupipLookupCache = new Hashtable<InetAddress, SoftReference<yacySeed>>();@@ -416,7 +416,7 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {if (seed.isProper(false) != null) return;//seed.put(yacySeed.LASTSEEN, yacyCore.shortFormatter.format(new Date(yacyCore.universalTime())));try {- nameLookupCache.put(seed.getName(), seed);+ nameLookupCache.put(seed.getName(), seed.hash);final Map<String, String> seedPropMap = seed.getMap();synchronized (seedPropMap) {seedActiveDB.put(seed.hash, seedPropMap);@@ -582,9 +582,13 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {}// then try to use the cache- yacySeed seed = nameLookupCache.get(peerName);- if (seed != null) return seed;-+ String seedhash = nameLookupCache.get(peerName);+ yacySeed seed;+ if (seedhash != null) {+ seed = this.get(seedhash);+ if (seed != null) return seed;+ }+// enumerate the cache and simultanous insert valuesString name;for (int table = 0; table < 2; table++) {@@ -593,7 +597,7 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {seed = e.next();if (seed != null) {name = seed.getName().toLowerCase();- if (seed.isProper(false) == null) nameLookupCache.put(name, seed);+ if (seed.isProper(false) == null) nameLookupCache.put(name, seed.hash);if (name.equals(peerName)) return seed;}}@@ -601,7 +605,7 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {// check local seedif (this.mySeed == null) initMySeed();name = mySeed.getName().toLowerCase();- if (mySeed.isProper(false) == null) nameLookupCache.put(name, mySeed);+ if (mySeed.isProper(false) == null) nameLookupCache.put(name, mySeed.hash);if (name.equals(peerName)) return mySeed;// nothing foundreturn null;