orbiter 18 years ago
parent 35c660654d
commit d4428947af

@ -65,9 +65,12 @@ 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 work
prop.putASIS("response", "-1"); // request rejected
return prop;
}

@ -74,7 +74,7 @@ public final class transferRWI {
// request values
final 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 key
final int wordc = Integer.parseInt(post.get("wordc", "")); // number of different words
final int entryc = Integer.parseInt(post.get("entryc", "")); // number of entries in indexes
@ -89,23 +89,13 @@ public final class transferRWI {
// response values
String result = "ok";
StringBuffer unknownURLs = new StringBuffer();
int pause = 0;
/*
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) {}
}
}
*/
int pause = 10000;
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 indexes
sb.getLog().logInfo("Rejecting RWIs from peer " + otherPeerName + ". Not granted.");
result = "not_granted";

@ -76,7 +76,7 @@ public final class transferURL {
// request values
final 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 key
final int urlc = post.getInt("urlc", 0); // number of transported urls
final 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 {

Loading…
Cancel
Save