Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fixed non-termination bug for robinson remote crawl peer selection
orbiter0831034e076c
diff --git a/source/de/anomic/kelondro/kelondroCloneableMapIterator.java b/source/de/anomic/kelondro/kelondroCloneableMapIterator.javaindex f35852583..dd11c16cd 100644--- a/source/de/anomic/kelondro/kelondroCloneableMapIterator.java+++ b/source/de/anomic/kelondro/kelondroCloneableMapIterator.java@@ -39,8 +39,9 @@ public class kelondroCloneableMapIterator implements kelondroCloneableIterator {public kelondroCloneableMapIterator(TreeMap map, Object start) {- // set must contain byte[] elements or String elements.+ // map must contain eiter a byte[]/Object or a String/Object mapping.// start must be either of type byte[] or String+ // this iterator iterates then only the key elements of the mapthis.map = map;this.start = start;this.iter = map.keySet().iterator();diff --git a/source/de/anomic/yacy/yacyDHTAction.java b/source/de/anomic/yacy/yacyDHTAction.javaindex bf1215d80..b0d7ddd43 100644--- a/source/de/anomic/yacy/yacyDHTAction.java+++ b/source/de/anomic/yacy/yacyDHTAction.java@@ -218,11 +218,15 @@ public class yacyDHTAction implements yacyPeerAction {}public synchronized yacySeed getPublicClusterCrawlSeed(String urlHash, TreeMap clusterhashes) {+ // clusterhashes is a String(hash)/String(IP) - mappingkelondroCloneableIterator i = new kelondroRotateIterator(new kelondroCloneableMapIterator(clusterhashes, urlHash), null);- while (i.hasNext()) {- yacySeed seed = seedDB.getConnected((String) i.next());+ String hash;+ int count = clusterhashes.size(); // counter to ensure termination+ while ((i.hasNext()) && (count-- > 0)) {+ hash = (String) i.next();+ yacySeed seed = seedDB.getConnected(hash);if (seed == null) continue;- if (clusterhashes != null) seed.setAlternativeAddress((String) clusterhashes.get(seed.hash));+ seed.setAlternativeAddress((String) clusterhashes.get(hash));return seed;}return null;