mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3438 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
958ebea5c5
commit
313f6a7680
|
@ -168,15 +168,25 @@ public class plasmaDHTChunk {
|
||||||
String startPointHash;
|
String startPointHash;
|
||||||
// first try to select with increasing probality a good start point
|
// first try to select with increasing probality a good start point
|
||||||
double minimumDistance = ((double) peerRedundancy) / ((double) yacyCore.seedDB.sizeConnected());
|
double minimumDistance = ((double) peerRedundancy) / ((double) yacyCore.seedDB.sizeConnected());
|
||||||
if (Math.round(Math.random() * 6) != 4)
|
double d, bestDistance = 0.0;
|
||||||
for (int i = 9; i > 0; i--) {
|
String bestHash = null;
|
||||||
startPointHash = kelondroBase64Order.enhancedCoder.encode(serverCodings.encodeMD5Raw(Long.toString(i + System.currentTimeMillis()))).substring(2, 2 + yacySeedDB.commonHashLength);
|
for (int i = yacyCore.seedDB.sizeConnected() / 8; i > 0; i--) {
|
||||||
if (yacyDHTAction.dhtDistance(yacyCore.seedDB.mySeed.hash, startPointHash) > (minimumDistance + ((double) i / (double) 10)))
|
startPointHash = kelondroBase64Order.enhancedCoder.encode(serverCodings.encodeMD5Raw(Long.toString(i + System.currentTimeMillis()))).substring(2, 2 + yacySeedDB.commonHashLength);
|
||||||
return startPointHash;
|
d = yacyDHTAction.dhtDistance(yacyCore.seedDB.mySeed.hash, startPointHash);
|
||||||
|
if (d > (minimumDistance + ((double) i / (double) 10))) {
|
||||||
|
return startPointHash;
|
||||||
}
|
}
|
||||||
// if that fails, take simply the best start point (this is usually avoided, since that leads to always the same target peers)
|
if (d > bestDistance) {
|
||||||
startPointHash = yacyCore.seedDB.mySeed.hash.substring(0, 11) + "z";
|
bestDistance = d;
|
||||||
return startPointHash;
|
bestHash = startPointHash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if that fails, take simply the best start point
|
||||||
|
if (bestHash == null) {
|
||||||
|
return yacyCore.seedDB.mySeed.hash.substring(0, 11) + "z";
|
||||||
|
} else {
|
||||||
|
return bestHash;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectTransferContainers(String hash, int mincount, int maxcount, int maxtime) throws InterruptedException {
|
private void selectTransferContainers(String hash, int mincount, int maxcount, int maxtime) throws InterruptedException {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user