Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
- fixed/enhanced move to SD/16:9 images (network, web structure) - added logging in peer ping to analyse time-consuming elements which could be cause for disappearing peers
orbiter28f669bf0ba5
diff --git a/htroot/Network.java b/htroot/Network.javaindex fdf26eba4..50ea93f8e 100644--- a/htroot/Network.java+++ b/htroot/Network.java@@ -206,7 +206,7 @@ public class Network {yacySeed peer = new yacySeed(post.get("peerHash"), map);sb.updateMySeed();- final int added = yacyClient.publishMySeed(sb.peers.mySeed(), sb.peers.peerActions, peer.getPublicAddress(), peer.hash);+ final int added = yacyClient.hello(sb.peers.mySeed(), sb.peers.peerActions, peer.getPublicAddress(), peer.hash);if (added <= 0) {prop.put("table_comment",1);diff --git a/htroot/NetworkPicture.java b/htroot/NetworkPicture.javaindex e0ae3c363..92baea5c4 100644--- a/htroot/NetworkPicture.java+++ b/htroot/NetworkPicture.java@@ -90,7 +90,7 @@ public class NetworkPicture {if (height < 240) height = 240;if (height > 1080) height = 1080;if (!authorized) {- width = Math.min(768, width);+ width = Math.min(1024, width);height = Math.min(576, height);}if (passiveLimit > 1000000) passiveLimit = 1000000;diff --git a/htroot/WatchWebStructure_p.java b/htroot/WatchWebStructure_p.javaindex 50dbc0e26..e11251138 100644--- a/htroot/WatchWebStructure_p.java+++ b/htroot/WatchWebStructure_p.java@@ -24,7 +24,7 @@ public class WatchWebStructure_p {String color_line = "222222";String color_lineend = "333333";- int width = 768;+ int width = 1024;int height = 576;int depth = 3;int nodes = 500; // maximum number of host nodes that are painted@@ -33,10 +33,10 @@ public class WatchWebStructure_p {String besthost;if (post != null) {- width = post.getInt("width", 768);+ width = post.getInt("width", 1024);height = post.getInt("height", 576);depth = post.getInt("depth", 3);- nodes = post.getInt("nodes", width * height * 100 / 768 / 576);+ nodes = post.getInt("nodes", width * height * 100 / 1024 / 576);time = post.getInt("time", -1);host = post.get("host", "auto");color_text = post.get("colortext", color_text);diff --git a/htroot/WebStructurePicture_p.java b/htroot/WebStructurePicture_p.javaindex 36bcc3462..0d91f13c0 100644--- a/htroot/WebStructurePicture_p.java+++ b/htroot/WebStructurePicture_p.java@@ -57,7 +57,7 @@ public class WebStructurePicture_p {String color_line = "222222";String color_lineend = "333333";- int width = 768;+ int width = 1024;int height = 576;int depth = 3;int nodes = 100; // maximum number of host nodes that are painted@@ -65,10 +65,10 @@ public class WebStructurePicture_p {String host = null;if (post != null) {- width = post.getInt("width", 768);+ width = post.getInt("width", 1024);height = post.getInt("height", 576);depth = post.getInt("depth", 3);- nodes = post.getInt("nodes", width * height * 100 / 768 / 576);+ nodes = post.getInt("nodes", width * height * 100 / 1024 / 576);time = post.getInt("time", -1);host = post.get("host", null);color_text = post.get("colortext", color_text);diff --git a/htroot/yacy/hello.java b/htroot/yacy/hello.javaindex 572e4dc4d..b6b3d1340 100644--- a/htroot/yacy/hello.java+++ b/htroot/yacy/hello.java@@ -77,13 +77,16 @@ public final class hello {try {count = (countStr == null) ? 0 : Integer.parseInt(countStr);} catch (final NumberFormatException e) {count = 0;}// final Date remoteTime = yacyCore.parseUniversalDate(post.get(MYTIME)); // read remote timefinal String clientip = header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "<unknown>"); // read an artificial header addendum+ long time = System.currentTimeMillis();final InetAddress ias = Domains.dnsResolve(clientip);+ long time_dnsResolve = System.currentTimeMillis() - time;if (ias == null) {+ yacyCore.log.logInfo("hello/server: failed contacting seed; clientip not resolvable (clientip=" + clientip + ", time_dnsResolve=" + time_dnsResolve + ")");prop.put("message", "cannot resolve your IP from your reported location " + clientip);return prop;}if (seed.length() > yacySeed.maxsize) {- yacyCore.log.logInfo("hello/server: rejected contacting seed; too large (" + seed.length() + " > " + yacySeed.maxsize + ")");+ yacyCore.log.logInfo("hello/server: rejected contacting seed; too large (" + seed.length() + " > " + yacySeed.maxsize + ", time_dnsResolve=" + time_dnsResolve + ")");prop.put("message", "your seed is too long (" + seed.length() + ")");return prop;}@@ -91,13 +94,13 @@ public final class hello {try {remoteSeed = yacySeed.genRemoteSeed(seed, key, true);} catch (IOException e) {- yacyCore.log.logInfo("hello/server: bad seed: " + e.getMessage());+ yacyCore.log.logInfo("hello/server: bad seed: " + e.getMessage() + ", time_dnsResolve=" + time_dnsResolve);prop.put("message", "bad seed: " + e.getMessage());return prop;}-// System.out.println("YACYHELLO: REMOTESEED=" + ((remoteSeed == null) ? "NULL" : remoteSeed.toString()));if (remoteSeed == null || remoteSeed.hash == null) {+ yacyCore.log.logInfo("hello/server: bad seed: null, time_dnsResolve=" + time_dnsResolve);prop.put("message", "cannot parse your seed");return prop;}@@ -124,6 +127,9 @@ public final class hello {// if the remote client has reported its own IP address and the client supports// the port forwarding feature (if client version >= 0.383) then we try to// connect to the reported IP address first+ time = System.currentTimeMillis();+ long time_backping = 0;+ String backping_method = "none";if (reportedip.length() > 0 && !clientip.equals(reportedip) && clientversion >= yacyVersion.YACY_SUPPORTS_PORT_FORWARDING) {serverCore.checkInterruption();@@ -131,13 +137,15 @@ public final class hello {prop.put("yourip", reportedip);remoteSeed.setIP(reportedip);urls = yacyClient.queryUrlCount(remoteSeed);+ time_backping = System.currentTimeMillis() - time;+ backping_method = "reportedip=" + reportedip;} else {prop.put("yourip", ias.getHostAddress());remoteSeed.setIP(ias.getHostAddress());}- // if the previous attempt (using the reported ip address) was not successful, try the ip where- // the request came from+ // if the previous attempt (using the reported ip address) was not successful,+ // then try the ip where the request came fromif (urls < 0) {boolean isNotLocal = true;@@ -151,6 +159,8 @@ public final class hello {prop.put("yourip", clientip);remoteSeed.setIP(clientip);urls = yacyClient.queryUrlCount(remoteSeed);+ time_backping = System.currentTimeMillis() - time;+ backping_method = "clientip=" + clientip;}}@@ -170,11 +180,12 @@ public final class hello {remoteSeed.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR);}// connect the seed+ yacyCore.log.logInfo("hello/server: responded remote senior peer '" + remoteSeed.getName() + "' from " + reportedip + ", time_dnsResolve=" + time_dnsResolve + ", time_backping=" + time_backping + ", method=" + backping_method + ", urls=" + urls);sb.peers.peerActions.peerArrival(remoteSeed, true);} else {prop.put(yacySeed.YOURTYPE, yacySeed.PEERTYPE_JUNIOR);remoteSeed.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR);- yacyCore.log.logInfo("hello: responded remote junior peer '" + remoteSeed.getName() + "' from " + reportedip);+ yacyCore.log.logInfo("hello/server: responded remote junior peer '" + remoteSeed.getName() + "' from " + reportedip + ", time_dnsResolve=" + time_dnsResolve + ", time_backping=" + time_backping + ", method=" + backping_method + ", urls=" + urls);// no connection here, instead store junior in connection cacheif ((remoteSeed.hash != null) && (remoteSeed.isProper(false) == null)) {sb.peers.peerActions.peerPing(remoteSeed);@@ -182,7 +193,7 @@ public final class hello {}sb.peers.peerActions.setUserAgent(clientip, userAgent);if (!(prop.get(yacySeed.YOURTYPE)).equals(reportedPeerType)) {- yacyCore.log.logInfo("hello: changing remote peer '" + remoteSeed.getName() ++ yacyCore.log.logInfo("hello/server: changing remote peer '" + remoteSeed.getName() +"' [" + reportedip +"] peerType from '" + reportedPeerType +"' to '" + prop.get(yacySeed.YOURTYPE) + "'.");@@ -229,7 +240,7 @@ public final class hello {prop.put("seedlist", seeds.toString());// return rewrite propertiesprop.put("message", "ok " + seed.length());- yacyCore.log.logInfo("hello: responded remote peer '" + remoteSeed.getName() + "' [" + reportedip + "] in " + (System.currentTimeMillis() - start) + " milliseconds");+ yacyCore.log.logInfo("hello/server: responded remote peer '" + remoteSeed.getName() + "' [" + reportedip + "] in " + (System.currentTimeMillis() - start) + " milliseconds");return prop;}diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.javaindex 9d68bb4f3..fe6f6943f 100644--- a/source/de/anomic/yacy/yacyClient.java+++ b/source/de/anomic/yacy/yacyClient.java@@ -125,7 +125,7 @@ public final class yacyClient {** @return the number of new seeds*/- public static int publishMySeed(final yacySeed mySeed, final yacyPeerActions peerActions, final String address, final String otherHash) {+ public static int hello(final yacySeed mySeed, final yacyPeerActions peerActions, final String address, final String otherHash) {Map<String, String> result = null;final String salt = crypt.randomSalt();@@ -137,20 +137,20 @@ public final class yacyClient {// send requestfinal long start = System.currentTimeMillis();final byte[] content = HTTPConnector.getConnector(MultiProtocolURI.yacybotUserAgent).post(new MultiProtocolURI("http://" + address + "/yacy/hello.html"), 30000, yacySeed.b64Hash2hexHash(otherHash) + ".yacyh", parts);- yacyCore.log.logInfo("yacyClient.publishMySeed thread '" + Thread.currentThread().getName() + "' contacted peer at " + address + ", received " + ((content == null) ? "null" : content.length) + " bytes, time = " + (System.currentTimeMillis() - start) + " milliseconds");+ yacyCore.log.logInfo("yacyClient.hello thread '" + Thread.currentThread().getName() + "' contacted peer at " + address + ", received " + ((content == null) ? "null" : content.length) + " bytes, time = " + (System.currentTimeMillis() - start) + " milliseconds");result = FileUtils.table(content);} catch (final Exception e) {if (Thread.currentThread().isInterrupted()) {- yacyCore.log.logInfo("yacyClient.publishMySeed thread '" + Thread.currentThread().getName() + "' interrupted.");+ yacyCore.log.logInfo("yacyClient.hello thread '" + Thread.currentThread().getName() + "' interrupted.");return -1;}- yacyCore.log.logInfo("yacyClient.publishMySeed thread '" + Thread.currentThread().getName() + "', peer " + address + "; exception: " + e.getMessage());+ yacyCore.log.logInfo("yacyClient.hello thread '" + Thread.currentThread().getName() + "', peer " + address + "; exception: " + e.getMessage());// try again (go into loop)result = null;}if (result == null) {- yacyCore.log.logInfo("yacyClient.publishMySeed result error: " ++ yacyCore.log.logInfo("yacyClient.hello result error: " +((result == null) ? "result null" : ("result=" + result.toString())));return -1;}@@ -167,11 +167,11 @@ public final class yacyClient {try {otherPeer = yacySeed.genRemoteSeed(seed, salt, false);if (!otherPeer.hash.equals(otherHash)) {- yacyCore.log.logInfo("yacyClient.publishMySeed: consistency error: otherPeer.hash = " + otherPeer.hash + ", otherHash = " + otherHash);+ yacyCore.log.logInfo("yacyClient.hello: consistency error: otherPeer.hash = " + otherPeer.hash + ", otherHash = " + otherHash);return -1; // no success}} catch (IOException e) {- yacyCore.log.logInfo("yacyClient.publishMySeed: consistency error: other seed bad:" + e.getMessage() + ", seed=" + seed);+ yacyCore.log.logInfo("yacyClient.hello: consistency error: other seed bad:" + e.getMessage() + ", seed=" + seed);return -1; // no success}}@@ -207,13 +207,13 @@ public final class yacyClient {* If this is true we try to reconnect the sch channel to the remote server now.*/if (mytype.equalsIgnoreCase(yacySeed.PEERTYPE_JUNIOR)) {- yacyCore.log.logInfo("yacyClient.publishMySeed: Peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' reported us as junior.");+ yacyCore.log.logInfo("yacyClient.hello: Peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' reported us as junior.");} else if ((mytype.equalsIgnoreCase(yacySeed.PEERTYPE_SENIOR)) ||(mytype.equalsIgnoreCase(yacySeed.PEERTYPE_PRINCIPAL))) {- if (yacyCore.log.isFine()) yacyCore.log.logFine("yacyClient.publishMySeed: Peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' reported us as " + mytype + ", accepted other peer.");+ if (yacyCore.log.isFine()) yacyCore.log.logFine("yacyClient.hello: Peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' reported us as " + mytype + ", accepted other peer.");} else {// wrong type report- if (yacyCore.log.isFine()) yacyCore.log.logFine("yacyClient.publishMySeed: Peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' reported us as " + mytype + ", rejecting other peer.");+ if (yacyCore.log.isFine()) yacyCore.log.logFine("yacyClient.hello: Peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' reported us as " + mytype + ", rejecting other peer.");return -1;}if (mySeed.orVirgin().equals(yacySeed.PEERTYPE_VIRGIN))@@ -221,7 +221,7 @@ public final class yacyClient {final String error = mySeed.isProper(true);if (error != null) {- yacyCore.log.logSevere("yacyClient.publishMySeed mySeed error - not proper: " + error);+ yacyCore.log.logSevere("yacyClient.hello mySeed error - not proper: " + error);return -1;}diff --git a/source/de/anomic/yacy/yacyCore.java b/source/de/anomic/yacy/yacyCore.javaindex e22a1729f..4586b641e 100644--- a/source/de/anomic/yacy/yacyCore.java+++ b/source/de/anomic/yacy/yacyCore.java@@ -231,7 +231,7 @@ public class yacyCore {public final void run() {try {- this.added = yacyClient.publishMySeed(sb.peers.mySeed(), sb.peers.peerActions, seed.getClusterAddress(), seed.hash);+ this.added = yacyClient.hello(sb.peers.mySeed(), sb.peers.peerActions, seed.getClusterAddress(), seed.hash);if (this.added < 0) {// no or wrong response, delete that addressfinal String cause = "peer ping to peer resulted in error response (added < 0)";