Browse Source

Do nothing if block has already acquired.

This happens in end-game mode.
Tatsuhiro Tsujikawa 14 years ago
parent
commit
44c379eaa8
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/BtPieceMessage.cc

+ 4 - 0
src/BtPieceMessage.cc

@@ -115,6 +115,10 @@ void BtPieceMessage::doReceivedAction()
                      blockLength_,
                      static_cast<long long int>(offset),
                      static_cast<unsigned long>(slot.getBlockIndex())));
+    if(piece->hasBlock(slot.getBlockIndex())) {
+      A2_LOG_DEBUG("Already have this block.");
+      return;
+    }
     getPieceStorage()->getDiskAdaptor()->writeData
       (block_, blockLength_, offset);
     piece->completeBlock(slot.getBlockIndex());