Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fix for http://www.yacy-forum.de/viewtopic.php?p=34962#34962
orbiterd4428947afb3
diff --git a/htroot/yacy/query.java b/htroot/yacy/query.javaindex 882fd4f17..382100b7d 100644--- a/htroot/yacy/query.java+++ b/htroot/yacy/query.java@@ -65,13 +65,16 @@ public final class query {if (prop == null || sb == null) { return null; }if ((sb.isRobinsonMode()) &&- (!((sb.isPublicRobinson()) ||- (sb.isInMyCluster((String)header.get(httpHeader.CONNECTION_PROP_CLIENTIP)))))) {- // if we are a robinson cluster, answer only if this client is known by our network definition+ (!sb.isPublicRobinson()) &&+ (!sb.isInMyCluster((String)header.get(httpHeader.CONNECTION_PROP_CLIENTIP)))) {+ // if we are a robinson cluster, answer only if we are public robinson peers,+ // or we are a private cluster and the requester is in our cluster.+ // if we don't answer, the remote peer will recognize us as junior peer,+ // what would mean that our peer ping does not workprop.putASIS("response", "-1"); // request rejectedreturn prop;}-+// System.out.println("YACYQUERY: RECEIVED POST = " + ((post == null) ? "NULL" : post.toString()));// final String iam = post.get("iam", ""); // complete seed of the requesting peerdiff --git a/htroot/yacy/transferRWI.java b/htroot/yacy/transferRWI.javaindex 6dd0057cb..ee4668867 100644--- a/htroot/yacy/transferRWI.java+++ b/htroot/yacy/transferRWI.java@@ -74,7 +74,7 @@ public final class transferRWI {// request valuesfinal String iam = post.get("iam", ""); // seed hash of requester-// final String youare = (String) post.get("youare", ""); // seed hash of the target peer, needed for network stability+ final String youare = (String) post.get("youare", ""); // seed hash of the target peer, needed for network stability// final String key = (String) post.get("key", ""); // transmission keyfinal int wordc = Integer.parseInt(post.get("wordc", "")); // number of different wordsfinal int entryc = Integer.parseInt(post.get("entryc", "")); // number of entries in indexes@@ -89,23 +89,13 @@ public final class transferRWI {// response valuesString result = "ok";StringBuffer unknownURLs = new StringBuffer();- int pause = 0;+ int pause = 10000;- /*- boolean shortCacheFlush = false;- if ((granted) && (sb.wordIndex.busyCacheFlush)) {- // wait a little bit, maybe we got into a short flush slot- for (int i = 0; i < 20; i++) {- if (!(sb.wordIndex.busyCacheFlush)) {- shortCacheFlush = true;- break;- }- try {Thread.sleep(100);} catch (InterruptedException e) {}- }- }- */-- if ((!granted) || (sb.isRobinsonMode())) {+ if ((youare == null) || (!youare.equals(yacyCore.seedDB.mySeed.hash))) {+ sb.getLog().logInfo("Rejecting RWIs from peer " + otherPeerName + ". Wrong target. Wanted peer=" + youare + ", iam=" + yacyCore.seedDB.mySeed.hash);+ result = "wrong_target";+ pause = 0;+ } else if ((!granted) || (sb.isRobinsonMode())) {// we dont want to receive indexessb.getLog().logInfo("Rejecting RWIs from peer " + otherPeerName + ". Not granted.");result = "not_granted";diff --git a/htroot/yacy/transferURL.java b/htroot/yacy/transferURL.javaindex be6a966f2..a26822bcb 100644--- a/htroot/yacy/transferURL.java+++ b/htroot/yacy/transferURL.java@@ -76,7 +76,7 @@ public final class transferURL {// request valuesfinal String iam = post.get("iam", ""); // seed hash of requester-// final String youare = post.get("youare", ""); // seed hash of the target peer, needed for network stability+ final String youare = post.get("youare", ""); // seed hash of the target peer, needed for network stability// final String key = post.get("key", ""); // transmission keyfinal int urlc = post.getInt("urlc", 0); // number of transported urlsfinal boolean granted = sb.getConfig("allowReceiveIndex", "false").equals("true");@@ -89,7 +89,10 @@ public final class transferURL {final yacySeed otherPeer = yacyCore.seedDB.get(iam);final String otherPeerName = iam + ":" + ((otherPeer == null) ? "NULL" : (otherPeer.getName() + "/" + otherPeer.getVersion()));- if ((!granted) || (sb.isRobinsonMode())) {+ if ((youare == null) || (!youare.equals(yacyCore.seedDB.mySeed.hash))) {+ sb.getLog().logInfo("Rejecting URLs from peer " + otherPeerName + ". Wrong target. Wanted peer=" + youare + ", iam=" + yacyCore.seedDB.mySeed.hash);+ result = "wrong_target";+ } else if ((!granted) || (sb.isRobinsonMode())) {sb.getLog().logInfo("Rejecting URLs from peer " + otherPeerName + ". Not granted.");result = "error_not_granted";} else {