orbiter 16 years ago
parent 0e01e846ef
commit d31e6f9c14

@ -207,7 +207,10 @@ public class ConfigNetwork_p {
prop.put("robinson.checked", (indexDistribute || indexReceive) ? "0" : "1"); prop.put("robinson.checked", (indexDistribute || indexReceive) ? "0" : "1");
prop.putHTML("cluster.peers.ipport", sb.getConfig("cluster.peers.ipport", "")); prop.putHTML("cluster.peers.ipport", sb.getConfig("cluster.peers.ipport", ""));
prop.putHTML("cluster.peers.yacydomain", sb.getConfig("cluster.peers.yacydomain", "")); prop.putHTML("cluster.peers.yacydomain", sb.getConfig("cluster.peers.yacydomain", ""));
prop.put("cluster.peers.yacydomain.hashes", (sb.clusterhashes.size() == 0) ? "" : sb.clusterhashes.toString()); String hashes = "";
for (byte[] h:sb.clusterhashes.keySet()) hashes += ", " + new String(h);
if (hashes.length() > 2) hashes = hashes.substring(2);
prop.put("cluster.peers.yacydomain.hashes", hashes);
// set p2p mode flags // set p2p mode flags
prop.put("privatepeerChecked", (sb.getConfig("cluster.mode", "").equals("privatepeer")) ? "1" : "0"); prop.put("privatepeerChecked", (sb.getConfig("cluster.mode", "").equals("privatepeer")) ? "1" : "0");

@ -924,7 +924,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.
return network.indexOf(peer) >= 0; return network.indexOf(peer) >= 0;
} else if (clustermode.equals(plasmaSwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER)) { } else if (clustermode.equals(plasmaSwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER)) {
// check if we got the request from a peer in the public cluster // check if we got the request from a peer in the public cluster
return this.clusterhashes.containsKey(peer); return this.clusterhashes.containsKey(peer.getBytes());
} else { } else {
return false; return false;
} }
@ -942,7 +942,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.
return network.indexOf(seed.getPublicAddress()) >= 0; return network.indexOf(seed.getPublicAddress()) >= 0;
} else if (clustermode.equals(plasmaSwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER)) { } else if (clustermode.equals(plasmaSwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER)) {
// check if we got the request from a peer in the public cluster // check if we got the request from a peer in the public cluster
return this.clusterhashes.containsKey(seed.hash); return this.clusterhashes.containsKey(seed.hash.getBytes());
} else { } else {
return false; return false;
} }

@ -310,19 +310,19 @@ public class yacyCore {
// add also all peers from cluster if this is a public robinson cluster // add also all peers from cluster if this is a public robinson cluster
if (ch != null) { if (ch != null) {
final Iterator<Map.Entry<byte[], String>> i = ch.entrySet().iterator(); final Iterator<Map.Entry<byte[], String>> i = ch.entrySet().iterator();
byte[] hash; String hash;
Map.Entry<byte[], String> entry; Map.Entry<byte[], String> entry;
yacySeed seed; yacySeed seed;
while (i.hasNext()) { while (i.hasNext()) {
entry = i.next(); entry = i.next();
hash = entry.getKey(); hash = new String(entry.getKey());
seed = seeds.get(hash); seed = seeds.get(hash);
if (seed == null) { if (seed == null) {
seed = sb.webIndex.peers().get(new String(hash)); seed = sb.webIndex.peers().get(hash);
if (seed == null) continue; if (seed == null) continue;
} }
seed.setAlternativeAddress(entry.getValue()); seed.setAlternativeAddress(entry.getValue());
seeds.put(new String(hash), seed); seeds.put(hash, seed);
} }
} }
} else { } else {

Loading…
Cancel
Save