mirror of
https://github.com/aria2/aria2.git
synced 2025-04-05 05:27:38 +03:00
2009-11-23 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed ut_metadata data handling. Implemented UTMetadataDataExtensionMessage::doReceivedAction(). Initialize PeerStorage in HandshakeExtensionMessage::doReceivedAction() when metadata_size is received. * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/UTMetadataDataExtensionMessage.cc * src/UTMetadataDataExtensionMessage.h * src/UTMetadataRequestExtensionMessage.cc * src/UTMetadataRequestFactory.cc * src/UTMetadataRequestFactory.h * src/UTMetadataRequestTracker.cc * src/UTMetadataRequestTracker.h * test/DefaultExtensionMessageFactoryTest.cc * test/HandshakeExtensionMessageTest.cc * test/MockBtMessage.h * test/UTMetadataDataExtensionMessageTest.cc * test/UTMetadataRequestExtensionMessageTest.cc * test/UTMetadataRequestFactoryTest.cc * test/UTMetadataRequestTrackerTest.cc * test/extension_message_test_helper.h
This commit is contained in:
parent
b563621dd1
commit
c1730aeea9
20 changed files with 813 additions and 64 deletions
|
@ -21,6 +21,10 @@
|
|||
#include "UTMetadataRequestExtensionMessage.h"
|
||||
#include "UTMetadataDataExtensionMessage.h"
|
||||
#include "UTMetadataRejectExtensionMessage.h"
|
||||
#include "BtRuntime.h"
|
||||
#include "PieceStorage.h"
|
||||
#include "RequestGroup.h"
|
||||
#include "Option.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -42,6 +46,7 @@ private:
|
|||
SharedHandle<MockBtMessageDispatcher> _dispatcher;
|
||||
SharedHandle<MockBtMessageFactory> _messageFactory;
|
||||
SharedHandle<DownloadContext> _dctx;
|
||||
SharedHandle<RequestGroup> _requestGroup;
|
||||
public:
|
||||
void setUp()
|
||||
{
|
||||
|
@ -59,6 +64,11 @@ public:
|
|||
|
||||
_dctx.reset(new DownloadContext());
|
||||
|
||||
SharedHandle<Option> option(new Option());
|
||||
_requestGroup.reset(new RequestGroup(option));
|
||||
_requestGroup->setDownloadContext(_dctx);
|
||||
_dctx->setOwnerRequestGroup(_requestGroup.get());
|
||||
|
||||
_factory.reset(new DefaultExtensionMessageFactory());
|
||||
_factory->setPeerStorage(_peerStorage);
|
||||
_factory->setPeer(_peer);
|
||||
|
@ -155,7 +165,7 @@ void DefaultExtensionMessageFactoryTest::testCreateMessage_UTMetadataRequest()
|
|||
void DefaultExtensionMessageFactoryTest::testCreateMessage_UTMetadataData()
|
||||
{
|
||||
std::string data = getExtensionMessageID("ut_metadata")+
|
||||
"d8:msg_typei1e5:piecei1e10:total_sizei300ee10:0000000000";
|
||||
"d8:msg_typei1e5:piecei1e10:total_sizei300ee0000000000";
|
||||
SharedHandle<UTMetadataDataExtensionMessage> m =
|
||||
createMessage<UTMetadataDataExtensionMessage>(data);
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)1, m->getIndex());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue