mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-21 00:00:13 +02:00
better control for target peer selection for RWI transfer
see also http://www.yacy-forum.de/viewtopic.php?p=15343#15343 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1370 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
8d8a40c2d9
commit
71d5c2b2ca
|
@ -221,6 +221,9 @@ public final class plasmaWordIndexDistribution {
|
|||
// find a list of DHT-peers
|
||||
yacySeed[] seeds = new yacySeed[peerCount + 10];
|
||||
int hc0 = 0;
|
||||
double ownDistance = Math.min(yacyDHTAction.dhtDistance(yacyCore.seedDB.mySeed.hash, indexEntities[0].wordHash()),
|
||||
yacyDHTAction.dhtDistance(yacyCore.seedDB.mySeed.hash, indexEntities[indexEntities.length - 1].wordHash()));
|
||||
double maxDistance = Math.min(ownDistance, 0.4);
|
||||
synchronized (yacyCore.dhtAgent) {
|
||||
double avdist;
|
||||
Enumeration e = yacyCore.dhtAgent.getAcceptRemoteIndexSeeds(keyhash);
|
||||
|
@ -230,10 +233,13 @@ public final class plasmaWordIndexDistribution {
|
|||
return -1; // interrupted
|
||||
}
|
||||
seeds[hc0] = (yacySeed) e.nextElement();
|
||||
if ((seeds[hc0] != null) &&
|
||||
((avdist = (yacyDHTAction.dhtDistance(seeds[hc0].hash, indexEntities[0].wordHash()) + yacyDHTAction.dhtDistance(seeds[hc0].hash, indexEntities[indexEntities.length - 1].wordHash())) / 2.0) < 0.4)) {
|
||||
log.logInfo("Selected " + ((hc0 < peerCount) ? "primary" : "reserve") + " DHT target peer " + seeds[hc0].getName() + ":" + seeds[hc0].hash + ", distance = " + avdist);
|
||||
hc0++;
|
||||
if (seeds[hc0] != null) {
|
||||
avdist = Math.max(yacyDHTAction.dhtDistance(seeds[hc0].hash, indexEntities[0].wordHash()),
|
||||
yacyDHTAction.dhtDistance(seeds[hc0].hash, indexEntities[indexEntities.length - 1].wordHash()));
|
||||
if (avdist < maxDistance) {
|
||||
log.logInfo("Selected " + ((hc0 < peerCount) ? "primary" : "reserve") + " DHT target peer " + seeds[hc0].getName() + ":" + seeds[hc0].hash + ", distance = " + avdist);
|
||||
hc0++;
|
||||
}
|
||||
}
|
||||
}
|
||||
e = null; // finish enumeration
|
||||
|
|
Loading…
Reference in New Issue
Block a user