*) added possibility to "recycle" a DHTChunk that failed to transfer.

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2898 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
hydrox 18 years ago
parent 78d65e128e
commit 7e8669b15c

@ -81,6 +81,8 @@ public class plasmaDHTChunk {
private long selectionStartTime = 0;
private long selectionEndTime = 0;
private int transferFailedCounter = 0;
public indexContainer firstContainer() {
return indexContainers[0];
}
@ -313,4 +315,12 @@ public class plasmaDHTChunk {
if (this.selectionStartTime == 0 || this.selectionEndTime == 0) return -1;
return this.selectionEndTime-this.selectionStartTime;
}
public void incTransferFailedCounter() {
this.transferFailedCounter++;
}
public int getTransferFailedCounter() {
return transferFailedCounter;
}
}

@ -2408,8 +2408,17 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// show success
return true;
} else {
dhtTransferChunk.setStatus(plasmaDHTChunk.chunkStatus_FAILED);
log.logFine("DHT distribution: transfer FAILED");
dhtTransferChunk.incTransferFailedCounter();
int maxChunkFails = (int) getConfigLong("indexDistribution.maxChunkFails", 1);
if (dhtTransferChunk.getTransferFailedCounter() >= maxChunkFails) {
System.out.println("DEBUG: " + dhtTransferChunk.getTransferFailedCounter() + " of " + maxChunkFails + " sendings failed for this chunk, aborting!");
dhtTransferChunk.setStatus(plasmaDHTChunk.chunkStatus_FAILED);
log.logFine("DHT distribution: transfer FAILED");
}
else {
System.out.println("DEBUG: " + dhtTransferChunk.getTransferFailedCounter() + " of " + maxChunkFails + " sendings failed for this chunk, retrying!");
log.logFine("DHT distribution: transfer FAILED, sending this chunk again");
}
return false;
}
}

@ -702,6 +702,8 @@ indexDistribution.minChunkSize = 5
indexDistribution.maxChunkSize = 1000
indexDistribution.startChunkSize = 50
indexDistribution.maxChunkFails = 1
# defines if the peer should reject incoming index transfer
# request if a given limit is reached
indexDistribution.transferRWIReceiptLimitEnabled = true

Loading…
Cancel
Save