Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
- bugfix in ServerScannerList - speed up of generation of scanner list avoiding forced dns lookup
orbiterf970670a7c04
diff --git a/htroot/ServerScannerList.java b/htroot/ServerScannerList.javaindex 274bae9e9..801975986 100644--- a/htroot/ServerScannerList.java+++ b/htroot/ServerScannerList.java@@ -42,8 +42,8 @@ public class ServerScannerList {final serverObjects prop = new serverObjects();final Switchboard sb = (Switchboard)env;- prop.put("servertable_edit", post == null ? 0 : post.containsKey("edit") ? 1 : 0);- prop.put("servertable_list_edit", post == null ? 0 : post.containsKey("edit") ? 1 : 0);+ boolean edit = post != null && post.containsKey("edit");+ prop.put("servertable_edit", edit ? 1 : 0);prop.put("embedded", post == null ? 0 : post.containsKey("embedded") ? 1 : 0);prop.put("servertable", 0);@@ -66,6 +66,7 @@ public class ServerScannerList {try {u = new DigestURI(host.getKey().url());urlString = u.toNormalform(true, false);+ prop.put("servertable_list_" + i + "_edit", edit ? 1 : 0);prop.put("servertable_list_" + i + "_edit_pk", ASCII.String(u.hash()));prop.put("servertable_list_" + i + "_edit_count", i);prop.putHTML("servertable_list_" + i + "_protocol", u.getProtocol());diff --git a/source/net/yacy/cora/protocol/Domains.java b/source/net/yacy/cora/protocol/Domains.javaindex 797fb6e1b..24165ce31 100644--- a/source/net/yacy/cora/protocol/Domains.java+++ b/source/net/yacy/cora/protocol/Domains.java@@ -522,7 +522,18 @@ public class Domains {}*/}-++ /**+ * in case that the host name was resolved using a time-out request+ * it can be nice to push that information to the name cache+ * @param i the inet address+ * @param host the known host name+ */+ public static void setHostName(final InetAddress i, String host) {+ NAME_CACHE_HIT.insertIfAbsent(host, i);+ cacheHit_Insert++;+ }+public static InetAddress dnsResolve(String host) {if ((host == null) || (host.length() == 0)) return null;host = host.toLowerCase().trim();diff --git a/source/net/yacy/cora/protocol/Scanner.java b/source/net/yacy/cora/protocol/Scanner.javaindex 0cfa9fe84..7e6954d37 100644--- a/source/net/yacy/cora/protocol/Scanner.java+++ b/source/net/yacy/cora/protocol/Scanner.java@@ -80,8 +80,22 @@ public class Scanner extends Thread {return this.inetAddress;}public String getHostName() {- if (this.hostname != null) return this.hostname;- this.hostname = Domains.getHostName(this.inetAddress);+ if (this.hostname != null) {+ if (this.hostname.equals(this.inetAddress.getHostAddress())) {+ // if the hostname was created in case of a time-out from TimoutRequest+ // then in rare cases we try to get that name again+ if ( (System.currentTimeMillis() / 1000) % 10 != 1) return this.hostname;+ } else {+ return this.hostname;+ }+ }+ try {+ this.hostname = TimeoutRequest.getHostName(this.inetAddress, 100);+ Domains.setHostName(this.inetAddress, this.hostname);+ } catch (ExecutionException e) {+ this.hostname = this.inetAddress.getHostAddress();+ }+ //this.hostname = Domains.getHostName(this.inetAddress);return this.hostname;}public MultiProtocolURI url() throws MalformedURLException {