fixing block request stops after queue buffer filled up

This commit is contained in:
romanman 2014-12-01 22:35:23 +01:00
parent 2c9161dead
commit a2c0d28a13
1 changed files with 11 additions and 1 deletions

View File

@ -377,7 +377,17 @@ public class EthHandler extends SimpleChannelInboundHandler<EthMessage> {
// Parallel download blocks based on hashQueue
private void sendGetBlocks() {
BlockQueue queue = blockchain.getQueue();
if (queue.size() > CONFIG.maxBlocksQueued()) return;
if (queue.size() > CONFIG.maxBlocksQueued()){
logger.info("postpone asking for blocks: queue: {}", queue.size());
getBlocksTimer.schedule(new TimerTask() {
@Override
public void run() {
sendGetBlocks();
}
}, 100);
return;
}
// retrieve list of block hashes from queue
// save them locally in case the remote peer