- added debugging code for wrong DHT target iterator

- restricted distance constraint from 0.4 to 0.2

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3644 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 18 years ago
parent e0007b2764
commit 7cf8981a98

@ -3177,7 +3177,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
try { try {
// find a list of DHT-peers // find a list of DHT-peers
ArrayList seeds = yacyCore.dhtAgent.getDHTTargets(log, peerCount, 10, dhtChunk.firstContainer().getWordHash(), dhtChunk.lastContainer().getWordHash(), 0.4); ArrayList seeds = yacyCore.dhtAgent.getDHTTargets(log, peerCount, 10, dhtChunk.firstContainer().getWordHash(), dhtChunk.lastContainer().getWordHash(), 0.2);
if (seeds.size() < peerCount) { if (seeds.size() < peerCount) {
log.logWarning("found not enough (" + seeds.size() + ") peers for distribution for dhtchunk [" + dhtChunk.firstContainer().getWordHash() + " .. " + dhtChunk.lastContainer().getWordHash() + "]"); log.logWarning("found not enough (" + seeds.size() + ") peers for distribution for dhtchunk [" + dhtChunk.firstContainer().getWordHash() + " .. " + dhtChunk.lastContainer().getWordHash() + "]");
return false; return false;

@ -294,17 +294,22 @@ public class yacyDHTAction implements yacyPeerAction {
double ownDistance = Math.min(yacyDHTAction.dhtDistance(yacyCore.seedDB.mySeed.hash, firstKey), yacyDHTAction.dhtDistance(yacyCore.seedDB.mySeed.hash, lastKey)); double ownDistance = Math.min(yacyDHTAction.dhtDistance(yacyCore.seedDB.mySeed.hash, firstKey), yacyDHTAction.dhtDistance(yacyCore.seedDB.mySeed.hash, lastKey));
double maxDistance = Math.min(ownDistance, maxDist); double maxDistance = Math.min(ownDistance, maxDist);
double avdist; double avdist, firstdist, lastdist;
Enumeration e = this.getAcceptRemoteIndexSeeds(lastKey); Enumeration e = this.getAcceptRemoteIndexSeeds(lastKey);
Hashtable peerFilter = new Hashtable(); Hashtable peerFilter = new Hashtable();
if (log != null) log.logInfo("Collecting DHT target peers for first_hash = " + firstKey + ", last_hash = " + lastKey);
while ((e.hasMoreElements()) && (seeds.size() < (primaryPeerCount + reservePeerCount))) { while ((e.hasMoreElements()) && (seeds.size() < (primaryPeerCount + reservePeerCount))) {
seed = (yacySeed) e.nextElement(); seed = (yacySeed) e.nextElement();
if (seeds != null) { if (seeds != null) {
avdist = Math.max(yacyDHTAction.dhtDistance(seed.hash, firstKey), yacyDHTAction.dhtDistance(seed.hash, lastKey)); firstdist = yacyDHTAction.dhtDistance(seed.hash, firstKey);
lastdist = yacyDHTAction.dhtDistance(seed.hash, lastKey);
avdist = Math.max(firstdist, lastdist);
if (avdist < maxDistance && !peerFilter.containsKey(seed.hash)) { if (avdist < maxDistance && !peerFilter.containsKey(seed.hash)) {
if (log != null) log.logInfo("Selected " + ((seeds.size() < primaryPeerCount) ? "primary" : "reserve") + " DHT target peer " + seed.getName() + ":" + seed.hash + ", distance = " + avdist); if (log != null) log.logInfo("Selected " + ((seeds.size() < primaryPeerCount) ? "primary" : "reserve") + " DHT target peer " + seed.getName() + ":" + seed.hash + ", distance2first = " + firstdist + ", distance2last = " + lastdist);
seeds.add(seed); seeds.add(seed);
peerFilter.put(seed.hash, seed); peerFilter.put(seed.hash, seed);
} else {
if (log != null) log.logInfo("Discarded improper DHT target peer " + seed.getName() + ":" + seed.hash + ", distance2first = " + firstdist + ", distance2last = " + lastdist);
} }
} }
} }

Loading…
Cancel
Save