Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
better logging for WRONG seed
orbitere24dbde217ed
diff --git a/htroot/yacy/hello.java b/htroot/yacy/hello.javaindex 4da85e1ef..b83004001 100644--- a/htroot/yacy/hello.java+++ b/htroot/yacy/hello.java@@ -143,7 +143,7 @@ public class hello {remoteSeed.put("PeerType", "junior");yacyCore.log.logInfo("hello: responded remote junior peer '" + remoteSeed.getName() + "' from " + reportedip);// no connection here, instead store junior in connection cache- if ((remoteSeed.hash != null) && (remoteSeed.isProper())) yacyCore.peerActions.peerPing(remoteSeed);+ if ((remoteSeed.hash != null) && (remoteSeed.isProper() == null)) yacyCore.peerActions.peerPing(remoteSeed);}if (!((String)prop.get("yourtype")).equals(reportedPeerType)) {yacyCore.log.logInfo("hello: changing remote peer '" + remoteSeed.getName() + "' [" + reportedip + "] peerType from '" + reportedPeerType + "' to '" + prop.get("yourtype") + "'.");@@ -161,7 +161,7 @@ public class hello {yacySeed[] ys = yacyCore.seedDB.seedsByAge(true, count); // latest seedsint c = 1;for (int i = 1; i < ys.length; i++) {- if ((ys[i] != null) && (ys[i].isProper())) {+ if ((ys[i] != null) && (ys[i].isProper() == null)) {seeds += "seed" + c + "=" + ys[i].genSeedStr(key) + serverCore.crlfString;c++;}diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.javaindex d8e96540b..2897f2d5e 100644--- a/source/de/anomic/yacy/yacyClient.java+++ b/source/de/anomic/yacy/yacyClient.java@@ -189,9 +189,10 @@ public class yacyClient {yacyCore.seedDB.mySeed.put(yacySeed.PEERTYPE, mytype);}- if (!(yacyCore.seedDB.mySeed.isProper())) {+ String error;+ if ((error = yacyCore.seedDB.mySeed.isProper()) != null) {yacyCore.seedDB.mySeed = mySeedBkp;- yacyCore.log.logDebug("yacyClient.publishMySeed mySeed error: not proper");+ yacyCore.log.logDebug("yacyClient.publishMySeed mySeed error - not proper: " + error);return -1;}diff --git a/source/de/anomic/yacy/yacyCore.java b/source/de/anomic/yacy/yacyCore.javaindex 02f46ccc7..889baa488 100644--- a/source/de/anomic/yacy/yacyCore.java+++ b/source/de/anomic/yacy/yacyCore.java@@ -409,7 +409,7 @@ public class yacyCore {String address = seeds[i].getAddress();log.logDebug("HELLO #" + i + " to peer '" + seeds[i].get("Name", "") + "' at " + address); // debug- if ((address == null) || (!(seeds[i].isProper()))) {+ if ((address == null) || (seeds[i].isProper() != null)) {// we don't like that address, delete itpeerActions.peerDeparture(seeds[i]);sync.V();@@ -471,7 +471,7 @@ public class yacyCore {// }// if we have an address, we do nothing- if ((seedDB.mySeed.isProper()) && (!(force))) return 0;+ if ((seedDB.mySeed.isProper() == null) && (!(force))) return 0;// still no success: ask own NAT or internet responderboolean DI604use = switchboard.getConfig("DI604use", "false").equals("true");diff --git a/source/de/anomic/yacy/yacyPeerActions.java b/source/de/anomic/yacy/yacyPeerActions.javaindex baee12e95..3e8cb15fd 100644--- a/source/de/anomic/yacy/yacyPeerActions.java+++ b/source/de/anomic/yacy/yacyPeerActions.java@@ -169,7 +169,7 @@ public class yacyPeerActions {lc = 0;while (enu.hasMoreElements()) {ys = yacySeed.genRemoteSeed((String) enu.nextElement(), null, new Date());- if ((ys != null) && (ys.isProper()) &&+ if ((ys != null) && (ys.isProper() == null) &&((seedDB.mySeed == null) || (seedDB.mySeed.hash != ys.hash))) {if (connectPeer(ys, false)) lc++;//seedDB.writeMap(ys.hash, ys.getMap(), "init");@@ -239,11 +239,12 @@ public class yacyPeerActions {synchronized public boolean connectPeer(yacySeed seed, boolean direct) {// store a remote peer's seed// returns true if the peer is new and previously unknown- if (seed == null) {- yacyCore.log.logInfo("connect: WRONG seed (NULL)");+ String error;+ if (seed == null) {+ yacyCore.log.logError("connect: WRONG seed (NULL)");return false;- } else if (!(seed.isProper())) {- yacyCore.log.logInfo("connect: WRONG seed (" + seed.getName() + "/" + seed.hash + ")");+ } else if ((error = seed.isProper()) != null) {+ yacyCore.log.logError("connect: WRONG seed (" + seed.getName() + "/" + seed.hash + "): " + error);return false;} else if ((seedDB.mySeed != null) && (seed.hash.equals(seedDB.mySeed.hash))) {yacyCore.log.logInfo("connect: SELF reference " + seed.getAddress());diff --git a/source/de/anomic/yacy/yacySeed.java b/source/de/anomic/yacy/yacySeed.javaindex 1014253a8..7237f72c2 100644--- a/source/de/anomic/yacy/yacySeed.java+++ b/source/de/anomic/yacy/yacySeed.java@@ -381,13 +381,15 @@ public class yacySeed {return crypt.simpleEncode(toString(), key, method);}- public boolean isProper() {+ public String isProper() {// checks if everything is ok with that seed- if (this.hash == null) return false;- if (this.hash.length() != yacySeedDB.commonHashLength) return false;+ if (this.hash == null) return "hash is null";+ if (this.hash.length() != yacySeedDB.commonHashLength) return "wrong hash length (" + this.hash.length() + ")";String ip = (String) dna.get("IP");- if ((ip == null) || (ip.length() < 8)) return false;- return (natLib.isProper(ip));+ if (ip == null) return "IP is null";+ if (ip.length() < 8) return "IP is too short: " + ip;+ if (!(natLib.isProper(ip))) return "IP is not proper: " + ip;+ return null;}public void save(File f) throws IOException {diff --git a/source/de/anomic/yacy/yacySeedDB.java b/source/de/anomic/yacy/yacySeedDB.javaindex 8ce1549b8..74b0640b7 100644--- a/source/de/anomic/yacy/yacySeedDB.java+++ b/source/de/anomic/yacy/yacySeedDB.java@@ -342,7 +342,7 @@ public class yacySeedDB {public long countPotentialRWI() { return seedPotentialDB.getAcc("ICount"); }public synchronized void addConnected(yacySeed seed) {- if ((seed == null) || (!(seed.isProper()))) return;+ if ((seed == null) || (seed.isProper() != null)) return;//seed.put("LastSeen", yacyCore.shortFormatter.format(new Date(yacyCore.universalTime())));try {nameLookupCache.put(seed.getName(), seed);@@ -396,7 +396,7 @@ public class yacySeedDB {seedActiveDB.remove(seed.hash);seedPassiveDB.remove(seed.hash);} catch (Exception e) {}- if (!(seed.isProper())) return;+ if (seed.isProper() != null) return;//seed.put("LastSeen", yacyCore.shortFormatter.format(new Date(yacyCore.universalTime())));try {seedPotentialDB.set(seed.hash, seed.getMap());@@ -476,13 +476,13 @@ public class yacySeedDB {seed = (yacySeed) e.nextElement();if (seed != null) {name = seed.getName().toLowerCase();- if (seed.isProper()) nameLookupCache.put(name, seed);+ if (seed.isProper() == null) nameLookupCache.put(name, seed);if (name.equals(peerName)) return seed;}}// check local seedname = mySeed.getName().toLowerCase();- if (mySeed.isProper()) nameLookupCache.put(name, mySeed);+ if (mySeed.isProper() == null) nameLookupCache.put(name, mySeed);if (name.equals(peerName)) return mySeed;// nothing foundreturn null;