Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fixed bugs (dns, seedDB)
orbiter072052f15084
diff --git a/source/de/anomic/http/httpc.java b/source/de/anomic/http/httpc.javaindex c9b1f9f1f..747caa9e6 100644--- a/source/de/anomic/http/httpc.java+++ b/source/de/anomic/http/httpc.java@@ -92,7 +92,13 @@ public class httpc {private static HashMap nameCacheHit = new HashMap();//private static HashSet nameCacheMiss = new HashSet();- public static String dnsResolve(String host) {+ static {+ // set time-out of InetAddress.getByName cache ttl+ java.security.Security.setProperty("networkaddress.cache.ttl" , "60");+ java.security.Security.setProperty("networkaddress.cache.negative.ttl" , "0");+ }++ private static String dnsResolveX(String host) {// looks for the ip of host <host> and returns ip number as stringString ip = (String) nameCacheHit.get(host);if (ip != null) return ip;@@ -111,6 +117,18 @@ public class httpc {return null;}+ public static String dnsResolve(String host) {+ String ip = null;+ for (int i = 0; i < 50; i++) {+ ip = dnsResolveX(host);+ if (ip != null) {+ //if (i > 0) System.out.println(i + " attempts for " + host);+ return ip;+ }+ }+ return ip;+ }+public static boolean dnsFetch(String host) {// looks for the ip of host <host> and returns false if the host was in the cache// if it is not in the cache the ip is fetched and this resturns truediff --git a/source/de/anomic/kelondro/kelondroDyn.java b/source/de/anomic/kelondro/kelondroDyn.javaindex 0d2808290..6102a5fdc 100644--- a/source/de/anomic/kelondro/kelondroDyn.java+++ b/source/de/anomic/kelondro/kelondroDyn.java@@ -158,8 +158,11 @@ public class kelondroDyn extends kelondroTree {String k;String v;int c;+ byte[][] nt;while (ri.hasNext()) {- g = ((byte[][]) ri.next())[0];+ nt = (byte[][]) ri.next();+ if (nt == null) return null;+ g = nt[0];if (g == null) return null;k = new String(g, 0, keylen);v = new String(g, keylen, counterlen);diff --git a/source/de/anomic/kelondro/kelondroMap.java b/source/de/anomic/kelondro/kelondroMap.javaindex a92186c41..7044b1677 100644--- a/source/de/anomic/kelondro/kelondroMap.java+++ b/source/de/anomic/kelondro/kelondroMap.java@@ -96,6 +96,7 @@ public class kelondroMap {Map map;while (it.hasNext()) {key = (String) it.next();+ //System.out.println("kelondroMap: enumerating key " + key);map = get(key);if (sortfields != null) for (int i = 0; i < sortfields.length; i++) {@@ -422,6 +423,7 @@ public class kelondroMap {}try {Map map = get(nextKey);+ if (map == null) return null;map.put("key", nextKey);return map;} catch (IOException e) {diff --git a/source/de/anomic/kelondro/kelondroTree.java b/source/de/anomic/kelondro/kelondroTree.javaindex 24a91f9a9..fcf6f60c3 100644--- a/source/de/anomic/kelondro/kelondroTree.java+++ b/source/de/anomic/kelondro/kelondroTree.java@@ -251,12 +251,14 @@ public class kelondroTree extends kelondroRecords implements Comparator {Node nextNode = null;boolean up, rot;LinkedList nodeStack;+ int count;public nodeIterator(boolean up, boolean rotating) throws IOException {this(up, rotating, (up) ? firstNode() : lastNode());}public nodeIterator(boolean up, boolean rotating, Node start) throws IOException {+ this.count = 0;this.up = up;this.rot = rotating;this.nextNode = start;@@ -289,7 +291,9 @@ public class kelondroTree extends kelondroRecords implements Comparator {}public Object next() {+ count++;if (nextNode == null) return null;+ if (count > size()) return null;Object ret = nextNode;// middle-case@@ -890,7 +894,9 @@ public class kelondroTree extends kelondroRecords implements Comparator {public Object next() {try {- return ((Node) nodeIterator.next()).getValues();+ Node nextNode = (Node) nodeIterator.next();+ if (nextNode == null) return null; // this is an error case of the nodeIterator+ return nextNode.getValues();} catch (IOException e) {return null;}