Improve peer bitfield and piece stat update

On HAVE message reception and PIECE message transmission, update peer
bitfield and piece stat only if current peer bitfield indicates it
does not have the piece.
This commit is contained in:
Tatsuhiro Tsujikawa
2013-06-12 23:12:01 +09:00
parent 4ff6a9f1d4
commit 9eea959455
3 changed files with 23 additions and 7 deletions

View File

@@ -115,6 +115,7 @@ void BtHaveMessageTest::testDoReceivedAction_goodByeSeeder()
msg.doReceivedAction();
pieceStorage->setDownloadFinished(true);
peer->updateBitfield(1, 0);
try {
msg.doReceivedAction();
CPPUNIT_FAIL("exception must be thrown.");