2009-12-04 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Halt metadata download immediately when metadata download is done.
	Don't wait unresponsive tracker.
	* src/ByteArrayDiskWriter.h
	* src/DefaultBtInteractive.cc
	* src/DefaultExtensionMessageFactory.cc
	* src/DefaultExtensionMessageFactory.h
	* src/PeerInteractionCommand.cc
	* src/UTMetadataDataExtensionMessage.cc
	* src/UTMetadataDataExtensionMessage.h
	* src/UTMetadataRequestExtensionMessage.cc
	* test/UTMetadataDataExtensionMessageTest.cc
	* test/UTMetadataRequestExtensionMessageTest.cc
This commit is contained in:
Tatsuhiro Tsujikawa 2009-12-04 12:48:54 +00:00
parent 56265173bd
commit 625a102d1b
11 changed files with 26 additions and 28 deletions

View file

@ -7,7 +7,6 @@
#include "BtConstants.h"
#include "PieceStorage.h"
#include "DownloadContext.h"
#include "BtRuntime.h"
#include "DirectDiskAdaptor.h"
#include "ByteArrayDiskWriter.h"
#include "BDE.h"
@ -71,7 +70,6 @@ void UTMetadataDataExtensionMessageTest::testDoReceivedAction()
diskAdaptor->setDiskWriter(diskWriter);
SharedHandle<MockPieceStorage> pieceStorage(new MockPieceStorage());
pieceStorage->setDiskAdaptor(diskAdaptor);
SharedHandle<BtRuntime> btRuntime(new BtRuntime());
SharedHandle<UTMetadataRequestTracker> tracker
(new UTMetadataRequestTracker());
SharedHandle<DownloadContext> dctx(new DownloadContext());
@ -91,7 +89,6 @@ void UTMetadataDataExtensionMessageTest::testDoReceivedAction()
UTMetadataDataExtensionMessage m(1);
m.setPieceStorage(pieceStorage);
m.setBtRuntime(btRuntime);
m.setUTMetadataRequestTracker(tracker);
m.setDownloadContext(dctx);
@ -107,11 +104,11 @@ void UTMetadataDataExtensionMessageTest::testDoReceivedAction()
m.setIndex(0);
m.setData(piece0);
m.doReceivedAction();
CPPUNIT_ASSERT(!btRuntime->isHalt());
tracker->add(0);
m.doReceivedAction();
CPPUNIT_ASSERT(btRuntime->isHalt());
CPPUNIT_ASSERT_EQUAL(metadata, diskWriter->getString());
}
} // namespace aria2