2006-12-24 06:25:21 +00:00
|
|
|
/* <!-- copyright */
|
|
|
|
/*
|
|
|
|
* aria2 - The high speed download utility
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 Tatsuhiro Tsujikawa
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2010-01-05 16:01:46 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2006-12-24 06:25:21 +00:00
|
|
|
*
|
|
|
|
* In addition, as a special exception, the copyright holders give
|
|
|
|
* permission to link the code of portions of this program with the
|
|
|
|
* OpenSSL library under certain conditions as described in each
|
|
|
|
* individual source file, and distribute linked combinations
|
|
|
|
* including the two.
|
|
|
|
* You must obey the GNU General Public License in all respects
|
|
|
|
* for all of the code used other than OpenSSL. If you modify
|
|
|
|
* file(s) with this exception, you may extend this exception to your
|
|
|
|
* version of the file(s), but you are not obligated to do so. If you
|
|
|
|
* do not wish to do so, delete this exception statement from your
|
|
|
|
* version. If you delete this exception statement from all source
|
|
|
|
* files in the program, then also delete it here.
|
|
|
|
*/
|
|
|
|
/* copyright --> */
|
|
|
|
#include "DefaultBtMessageFactory.h"
|
|
|
|
#include "DlAbortEx.h"
|
2009-09-29 14:52:42 +00:00
|
|
|
#include "bittorrent_helper.h"
|
2006-12-24 06:25:21 +00:00
|
|
|
#include "BtKeepAliveMessage.h"
|
|
|
|
#include "BtChokeMessage.h"
|
|
|
|
#include "BtUnchokeMessage.h"
|
|
|
|
#include "BtInterestedMessage.h"
|
|
|
|
#include "BtNotInterestedMessage.h"
|
|
|
|
#include "BtHaveMessage.h"
|
|
|
|
#include "BtBitfieldMessage.h"
|
|
|
|
#include "BtBitfieldMessageValidator.h"
|
2009-03-12 15:54:43 +00:00
|
|
|
#include "RangeBtMessageValidator.h"
|
|
|
|
#include "IndexBtMessageValidator.h"
|
2006-12-24 06:25:21 +00:00
|
|
|
#include "BtRequestMessage.h"
|
|
|
|
#include "BtCancelMessage.h"
|
|
|
|
#include "BtPieceMessage.h"
|
|
|
|
#include "BtPieceMessageValidator.h"
|
|
|
|
#include "BtPortMessage.h"
|
|
|
|
#include "BtHaveAllMessage.h"
|
|
|
|
#include "BtHaveNoneMessage.h"
|
|
|
|
#include "BtRejectMessage.h"
|
|
|
|
#include "BtSuggestPieceMessage.h"
|
|
|
|
#include "BtAllowedFastMessage.h"
|
|
|
|
#include "BtHandshakeMessage.h"
|
|
|
|
#include "BtHandshakeMessageValidator.h"
|
2007-12-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added uTorrent compatible Peer Exchange.
* src/BencodeVisitor.{h, cc}
* test/BencodeVisitorTest.cc
* src/BtConstants.h
* src/BtContext.h: Added 'private' flag.
* src/BtExtendedMessage.{h, cc}
* test/BtExtendedMessageTest.cc
* src/BtHandshakeMessage.{h, cc}: Set extended messaging bit in
reserved field.
* test/BtHandshakeMessageTest.cc
* src/BtMessageFactory.h
* src/BtRegistry.h
* src/BtRuntime.h: This class holds default extension message
IDs for
aria2. By default, aria2 uses ID 8 for ut_pex.
* src/DefaultBtContext.cc
* src/DefaultBtInteractive.{h, cc}: This class holds
_utPexEnabled.
When it is true, aria2 enables ut_pex. This value is set by
PeerInteractionCommand.
* src/DefaultBtMessageFactory.{h, cc}
* test/DefaultBtMessageFactoryTest.cc
* src/DefaultBtMessageReceiver.cc: Moved the code of fast
extension
handling to DefaultBtInteractive class.
* src/DefaultExtensionMessageFactory.{h, cc}
* test/DefaultExtensionMessageFactoryTest.cc
* src/DefaultPeerStorage.cc: Returns false if a peer is already
in
the container(peers and incomingPeers. The equality is
determined by
Peer::id).
* test/DefaultPeerStorageTest.cc
* src/ExtensionMessage.h
* test/MockExtensionMessage.h
* src/ExtensionMessageFactory.h
* test/MockExtensionMessageFactory.h
* src/HandshakeExtensionMessage.{h, cc}
* test/HandshakeExtensionMessageTest.cc
* src/MetaEntry.h
* src/Peer.{h, cc}
* src/PeerInteractionCommand.cc
* src/PeerReceiveHandshakeCommand.cc: Evaluate the return value
of
addIncomingPeer.
* src/PeerMessageUtil.{h, cc}
* src/PeerObject.h
* src/UTPexExtensionMessage.{h, cc}
* test/UTPexExtensionMessageTest.cc
* src/message.h
* src/prefs.h
Fixed the bug that returns incomplete data when it contains null
character. A convenient constructor was also added.
* src/Data.{h, cc}
Rewritten.
* src/CompactPeerListProcessor.cc
Fixed typos.
* src/message.h
* src/MetaFileUtil.cc
2007-12-22 03:57:55 +00:00
|
|
|
#include "BtExtendedMessage.h"
|
|
|
|
#include "ExtensionMessage.h"
|
2008-02-08 15:53:45 +00:00
|
|
|
#include "Peer.h"
|
|
|
|
#include "Piece.h"
|
2009-06-28 10:37:15 +00:00
|
|
|
#include "DownloadContext.h"
|
2008-02-08 15:53:45 +00:00
|
|
|
#include "PieceStorage.h"
|
2008-11-03 06:49:02 +00:00
|
|
|
#include "PeerStorage.h"
|
2010-11-20 09:36:14 +00:00
|
|
|
#include "fmt.h"
|
2008-11-03 06:49:02 +00:00
|
|
|
#include "ExtensionMessageFactory.h"
|
2009-06-28 10:37:15 +00:00
|
|
|
#include "bittorrent_helper.h"
|
2008-02-08 15:53:45 +00:00
|
|
|
|
|
|
|
namespace aria2 {
|
2006-12-24 06:25:21 +00:00
|
|
|
|
2010-11-12 12:48:48 +00:00
|
|
|
DefaultBtMessageFactory::DefaultBtMessageFactory():
|
|
|
|
cuid_(0),
|
|
|
|
dhtEnabled_(false),
|
|
|
|
dispatcher_(0),
|
|
|
|
requestFactory_(0),
|
|
|
|
peerConnection_(0),
|
|
|
|
localNode_(0),
|
|
|
|
routingTable_(0),
|
|
|
|
taskQueue_(0),
|
|
|
|
taskFactory_(0),
|
|
|
|
metadataGetMode_(false)
|
2008-02-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added DHT functionality, compatible with mainline.
DHT is disabled by default. To enable it, give --enable-dht to
aria2c.
You may need to specify entry point to DHT network using
--dht-entry-point. DHT uses UDP port to listen incoming message.
Use --dht-listen-port to specify port number. Make sure that
your
firewall configuration can pass through UDP traffic to the port.
The routing table is saved in $HOME/.aria2/dht.dat.
* src/DHT*
* src/BNode.{h, cc}
* src/PeerInteractionCommand.cc: enable DHT functionality for a
particular torrent.
* src/Data.cc: Rewritten ctor.
* src/OptionHandlerFactory.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/DefaultBtInteractive.cc: Send port message if dht is
enabled.
* src/RequestGroup.cc: Initialize DHT functionality. When
download
ends, remove BtContext from DHTPeerAnnounceStorage.
* src/BtPortMessage.{h, cc}: Rewritten.
* src/message.h
* src/OptionHandlerImpl.cc
* src/option_processing.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/Dictionary.{h, cc} (remove): New function.
* src/prefs.h
* src/DefaultBtMessageFactory.h
* src/BtHandshakeMessage.cc
* src/ActivePeerConnectionCommand.cc
* src/SocketCore.{h, cc}: Added datagram socket support.
* src/DefaultBtMessageFactory.cc
* src/BtSetup.cc: Add BtContext to DHTPeerAnnounceStorage here.
Create DHT commands.
* src/BtMessageFactory.h
* src/PeerMessageUtil.{h, cc}
2008-02-01 17:36:33 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
DefaultBtMessageFactory::~DefaultBtMessageFactory() {}
|
|
|
|
|
2012-09-27 14:40:25 +00:00
|
|
|
SharedHandle<BtMessage>
|
2010-06-12 08:23:49 +00:00
|
|
|
DefaultBtMessageFactory::createBtMessage
|
|
|
|
(const unsigned char* data, size_t dataLength)
|
2006-12-24 06:25:21 +00:00
|
|
|
{
|
2012-09-27 14:40:25 +00:00
|
|
|
SharedHandle<AbstractBtMessage> msg;
|
2006-12-24 06:25:21 +00:00
|
|
|
if(dataLength == 0) {
|
|
|
|
// keep-alive
|
2008-04-20 00:50:22 +00:00
|
|
|
msg.reset(new BtKeepAliveMessage());
|
2006-12-24 06:25:21 +00:00
|
|
|
} else {
|
2009-09-29 14:52:42 +00:00
|
|
|
uint8_t id = bittorrent::getId(data);
|
2006-12-24 06:25:21 +00:00
|
|
|
switch(id) {
|
|
|
|
case BtChokeMessage::ID:
|
2012-09-27 14:40:25 +00:00
|
|
|
msg.reset(BtChokeMessage::create(data, dataLength));
|
2006-12-24 06:25:21 +00:00
|
|
|
break;
|
|
|
|
case BtUnchokeMessage::ID:
|
2012-09-27 14:40:25 +00:00
|
|
|
msg.reset(BtUnchokeMessage::create(data, dataLength));
|
2006-12-24 06:25:21 +00:00
|
|
|
break;
|
|
|
|
case BtInterestedMessage::ID:
|
2008-11-03 12:04:57 +00:00
|
|
|
{
|
2012-09-27 14:40:25 +00:00
|
|
|
BtInterestedMessage* m = BtInterestedMessage::create(data, dataLength);
|
2010-06-21 13:51:56 +00:00
|
|
|
m->setPeerStorage(peerStorage_);
|
2012-09-27 14:40:25 +00:00
|
|
|
msg.reset(m);
|
2008-11-03 12:04:57 +00:00
|
|
|
}
|
2006-12-24 06:25:21 +00:00
|
|
|
break;
|
|
|
|
case BtNotInterestedMessage::ID:
|
2008-11-03 06:49:02 +00:00
|
|
|
{
|
2012-09-27 14:40:25 +00:00
|
|
|
BtNotInterestedMessage* m =
|
2010-01-05 16:01:46 +00:00
|
|
|
BtNotInterestedMessage::create(data, dataLength);
|
2010-06-21 13:51:56 +00:00
|
|
|
m->setPeerStorage(peerStorage_);
|
2012-09-27 14:40:25 +00:00
|
|
|
msg.reset(m);
|
2008-11-03 06:49:02 +00:00
|
|
|
}
|
2006-12-24 06:25:21 +00:00
|
|
|
break;
|
|
|
|
case BtHaveMessage::ID:
|
2012-09-27 14:40:25 +00:00
|
|
|
msg.reset(BtHaveMessage::create(data, dataLength));
|
|
|
|
if(!metadataGetMode_) {
|
|
|
|
SharedHandle<BtMessageValidator> v
|
|
|
|
(new IndexBtMessageValidator(static_cast<BtHaveMessage*>(msg.get()),
|
|
|
|
downloadContext_->getNumPieces()));
|
|
|
|
msg->setBtMessageValidator(v);
|
2008-04-20 00:50:22 +00:00
|
|
|
}
|
2006-12-24 06:25:21 +00:00
|
|
|
break;
|
|
|
|
case BtBitfieldMessage::ID:
|
2012-09-27 14:40:25 +00:00
|
|
|
msg.reset(BtBitfieldMessage::create(data, dataLength));
|
|
|
|
if(!metadataGetMode_) {
|
|
|
|
SharedHandle<BtMessageValidator> v
|
|
|
|
(new BtBitfieldMessageValidator
|
|
|
|
(static_cast<BtBitfieldMessage*>(msg.get()),
|
|
|
|
downloadContext_->getNumPieces()));
|
|
|
|
msg->setBtMessageValidator(v);
|
2008-04-20 00:50:22 +00:00
|
|
|
}
|
2006-12-24 06:25:21 +00:00
|
|
|
break;
|
|
|
|
case BtRequestMessage::ID: {
|
2012-09-27 14:40:25 +00:00
|
|
|
BtRequestMessage* m = BtRequestMessage::create(data, dataLength);
|
2010-06-21 13:51:56 +00:00
|
|
|
if(!metadataGetMode_) {
|
2010-01-05 16:01:46 +00:00
|
|
|
SharedHandle<BtMessageValidator> validator
|
|
|
|
(new RangeBtMessageValidator
|
2012-09-27 14:40:25 +00:00
|
|
|
(m,
|
2010-06-21 13:51:56 +00:00
|
|
|
downloadContext_->getNumPieces(),
|
2012-09-27 14:40:25 +00:00
|
|
|
pieceStorage_->getPieceLength(m->getIndex())));
|
|
|
|
m->setBtMessageValidator(validator);
|
2009-11-22 14:52:17 +00:00
|
|
|
}
|
2012-09-27 14:40:25 +00:00
|
|
|
msg.reset(m);
|
2006-12-24 06:25:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BtCancelMessage::ID: {
|
2012-09-27 14:40:25 +00:00
|
|
|
BtCancelMessage* m = BtCancelMessage::create(data, dataLength);
|
2010-06-21 13:51:56 +00:00
|
|
|
if(!metadataGetMode_) {
|
2010-01-05 16:01:46 +00:00
|
|
|
SharedHandle<BtMessageValidator> validator
|
|
|
|
(new RangeBtMessageValidator
|
2012-09-27 14:40:25 +00:00
|
|
|
(m,
|
2010-06-21 13:51:56 +00:00
|
|
|
downloadContext_->getNumPieces(),
|
2012-09-27 14:40:25 +00:00
|
|
|
pieceStorage_->getPieceLength(m->getIndex())));
|
|
|
|
m->setBtMessageValidator(validator);
|
2009-11-22 14:52:17 +00:00
|
|
|
}
|
2012-09-27 14:40:25 +00:00
|
|
|
msg.reset(m);
|
2006-12-24 06:25:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BtPieceMessage::ID: {
|
2012-09-27 14:40:25 +00:00
|
|
|
BtPieceMessage* m = BtPieceMessage::create(data, dataLength);
|
2010-06-21 13:51:56 +00:00
|
|
|
if(!metadataGetMode_) {
|
2012-09-28 14:27:46 +00:00
|
|
|
SharedHandle<BtMessageValidator> validator
|
2010-06-12 08:23:49 +00:00
|
|
|
(new BtPieceMessageValidator
|
2012-09-27 14:40:25 +00:00
|
|
|
(m,
|
2010-06-21 13:51:56 +00:00
|
|
|
downloadContext_->getNumPieces(),
|
2012-09-27 14:40:25 +00:00
|
|
|
pieceStorage_->getPieceLength(m->getIndex())));
|
|
|
|
m->setBtMessageValidator(validator);
|
2009-11-22 14:52:17 +00:00
|
|
|
}
|
2012-09-27 14:40:25 +00:00
|
|
|
m->setDownloadContext(downloadContext_);
|
|
|
|
m->setPeerStorage(peerStorage_);
|
|
|
|
msg.reset(m);
|
2006-12-24 06:25:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BtHaveAllMessage::ID:
|
2012-09-27 14:40:25 +00:00
|
|
|
msg.reset(BtHaveAllMessage::create(data, dataLength));
|
2006-12-24 06:25:21 +00:00
|
|
|
break;
|
|
|
|
case BtHaveNoneMessage::ID:
|
2012-09-27 14:40:25 +00:00
|
|
|
msg.reset(BtHaveNoneMessage::create(data, dataLength));
|
2006-12-24 06:25:21 +00:00
|
|
|
break;
|
|
|
|
case BtRejectMessage::ID: {
|
2012-09-27 14:40:25 +00:00
|
|
|
BtRejectMessage* m = BtRejectMessage::create(data, dataLength);
|
2010-06-21 13:51:56 +00:00
|
|
|
if(!metadataGetMode_) {
|
2010-01-05 16:01:46 +00:00
|
|
|
SharedHandle<BtMessageValidator> validator
|
|
|
|
(new RangeBtMessageValidator
|
2012-09-27 14:40:25 +00:00
|
|
|
(m,
|
2010-06-21 13:51:56 +00:00
|
|
|
downloadContext_->getNumPieces(),
|
2012-09-27 14:40:25 +00:00
|
|
|
pieceStorage_->getPieceLength(m->getIndex())));
|
|
|
|
m->setBtMessageValidator(validator);
|
2009-11-22 14:52:17 +00:00
|
|
|
}
|
2012-09-27 14:40:25 +00:00
|
|
|
msg.reset(m);
|
2006-12-24 06:25:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BtSuggestPieceMessage::ID: {
|
2012-09-27 14:40:25 +00:00
|
|
|
BtSuggestPieceMessage* m =
|
2010-06-12 08:23:49 +00:00
|
|
|
BtSuggestPieceMessage::create(data, dataLength);
|
2010-06-21 13:51:56 +00:00
|
|
|
if(!metadataGetMode_) {
|
2010-01-05 16:01:46 +00:00
|
|
|
SharedHandle<BtMessageValidator> validator
|
2012-09-27 14:40:25 +00:00
|
|
|
(new IndexBtMessageValidator(m, downloadContext_->getNumPieces()));
|
|
|
|
m->setBtMessageValidator(validator);
|
2009-11-22 14:52:17 +00:00
|
|
|
}
|
2012-09-27 14:40:25 +00:00
|
|
|
msg.reset(m);
|
2006-12-24 06:25:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BtAllowedFastMessage::ID: {
|
2012-09-27 14:40:25 +00:00
|
|
|
BtAllowedFastMessage* m = BtAllowedFastMessage::create(data, dataLength);
|
2010-06-21 13:51:56 +00:00
|
|
|
if(!metadataGetMode_) {
|
2010-01-05 16:01:46 +00:00
|
|
|
SharedHandle<BtMessageValidator> validator
|
2012-09-27 14:40:25 +00:00
|
|
|
(new IndexBtMessageValidator(m, downloadContext_->getNumPieces()));
|
|
|
|
m->setBtMessageValidator(validator);
|
2009-11-22 14:52:17 +00:00
|
|
|
}
|
2012-09-27 14:40:25 +00:00
|
|
|
msg.reset(m);
|
2006-12-24 06:25:21 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-02-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added DHT functionality, compatible with mainline.
DHT is disabled by default. To enable it, give --enable-dht to
aria2c.
You may need to specify entry point to DHT network using
--dht-entry-point. DHT uses UDP port to listen incoming message.
Use --dht-listen-port to specify port number. Make sure that
your
firewall configuration can pass through UDP traffic to the port.
The routing table is saved in $HOME/.aria2/dht.dat.
* src/DHT*
* src/BNode.{h, cc}
* src/PeerInteractionCommand.cc: enable DHT functionality for a
particular torrent.
* src/Data.cc: Rewritten ctor.
* src/OptionHandlerFactory.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/DefaultBtInteractive.cc: Send port message if dht is
enabled.
* src/RequestGroup.cc: Initialize DHT functionality. When
download
ends, remove BtContext from DHTPeerAnnounceStorage.
* src/BtPortMessage.{h, cc}: Rewritten.
* src/message.h
* src/OptionHandlerImpl.cc
* src/option_processing.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/Dictionary.{h, cc} (remove): New function.
* src/prefs.h
* src/DefaultBtMessageFactory.h
* src/BtHandshakeMessage.cc
* src/ActivePeerConnectionCommand.cc
* src/SocketCore.{h, cc}: Added datagram socket support.
* src/DefaultBtMessageFactory.cc
* src/BtSetup.cc: Add BtContext to DHTPeerAnnounceStorage here.
Create DHT commands.
* src/BtMessageFactory.h
* src/PeerMessageUtil.{h, cc}
2008-02-01 17:36:33 +00:00
|
|
|
case BtPortMessage::ID: {
|
2012-09-27 14:40:25 +00:00
|
|
|
BtPortMessage* m = BtPortMessage::create(data, dataLength);
|
|
|
|
m->setLocalNode(localNode_);
|
|
|
|
m->setRoutingTable(routingTable_);
|
|
|
|
m->setTaskQueue(taskQueue_);
|
|
|
|
m->setTaskFactory(taskFactory_);
|
|
|
|
msg.reset(m);
|
2008-02-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added DHT functionality, compatible with mainline.
DHT is disabled by default. To enable it, give --enable-dht to
aria2c.
You may need to specify entry point to DHT network using
--dht-entry-point. DHT uses UDP port to listen incoming message.
Use --dht-listen-port to specify port number. Make sure that
your
firewall configuration can pass through UDP traffic to the port.
The routing table is saved in $HOME/.aria2/dht.dat.
* src/DHT*
* src/BNode.{h, cc}
* src/PeerInteractionCommand.cc: enable DHT functionality for a
particular torrent.
* src/Data.cc: Rewritten ctor.
* src/OptionHandlerFactory.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/DefaultBtInteractive.cc: Send port message if dht is
enabled.
* src/RequestGroup.cc: Initialize DHT functionality. When
download
ends, remove BtContext from DHTPeerAnnounceStorage.
* src/BtPortMessage.{h, cc}: Rewritten.
* src/message.h
* src/OptionHandlerImpl.cc
* src/option_processing.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/Dictionary.{h, cc} (remove): New function.
* src/prefs.h
* src/DefaultBtMessageFactory.h
* src/BtHandshakeMessage.cc
* src/ActivePeerConnectionCommand.cc
* src/SocketCore.{h, cc}: Added datagram socket support.
* src/DefaultBtMessageFactory.cc
* src/BtSetup.cc: Add BtContext to DHTPeerAnnounceStorage here.
Create DHT commands.
* src/BtMessageFactory.h
* src/PeerMessageUtil.{h, cc}
2008-02-01 17:36:33 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-12-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added uTorrent compatible Peer Exchange.
* src/BencodeVisitor.{h, cc}
* test/BencodeVisitorTest.cc
* src/BtConstants.h
* src/BtContext.h: Added 'private' flag.
* src/BtExtendedMessage.{h, cc}
* test/BtExtendedMessageTest.cc
* src/BtHandshakeMessage.{h, cc}: Set extended messaging bit in
reserved field.
* test/BtHandshakeMessageTest.cc
* src/BtMessageFactory.h
* src/BtRegistry.h
* src/BtRuntime.h: This class holds default extension message
IDs for
aria2. By default, aria2 uses ID 8 for ut_pex.
* src/DefaultBtContext.cc
* src/DefaultBtInteractive.{h, cc}: This class holds
_utPexEnabled.
When it is true, aria2 enables ut_pex. This value is set by
PeerInteractionCommand.
* src/DefaultBtMessageFactory.{h, cc}
* test/DefaultBtMessageFactoryTest.cc
* src/DefaultBtMessageReceiver.cc: Moved the code of fast
extension
handling to DefaultBtInteractive class.
* src/DefaultExtensionMessageFactory.{h, cc}
* test/DefaultExtensionMessageFactoryTest.cc
* src/DefaultPeerStorage.cc: Returns false if a peer is already
in
the container(peers and incomingPeers. The equality is
determined by
Peer::id).
* test/DefaultPeerStorageTest.cc
* src/ExtensionMessage.h
* test/MockExtensionMessage.h
* src/ExtensionMessageFactory.h
* test/MockExtensionMessageFactory.h
* src/HandshakeExtensionMessage.{h, cc}
* test/HandshakeExtensionMessageTest.cc
* src/MetaEntry.h
* src/Peer.{h, cc}
* src/PeerInteractionCommand.cc
* src/PeerReceiveHandshakeCommand.cc: Evaluate the return value
of
addIncomingPeer.
* src/PeerMessageUtil.{h, cc}
* src/PeerObject.h
* src/UTPexExtensionMessage.{h, cc}
* test/UTPexExtensionMessageTest.cc
* src/message.h
* src/prefs.h
Fixed the bug that returns incomplete data when it contains null
character. A convenient constructor was also added.
* src/Data.{h, cc}
Rewritten.
* src/CompactPeerListProcessor.cc
Fixed typos.
* src/message.h
* src/MetaFileUtil.cc
2007-12-22 03:57:55 +00:00
|
|
|
case BtExtendedMessage::ID: {
|
2010-06-21 13:51:56 +00:00
|
|
|
if(peer_->isExtendedMessagingEnabled()) {
|
2012-09-27 14:40:25 +00:00
|
|
|
msg.reset(BtExtendedMessage::create(extensionMessageFactory_,
|
|
|
|
peer_, data, dataLength));
|
2007-12-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added uTorrent compatible Peer Exchange.
* src/BencodeVisitor.{h, cc}
* test/BencodeVisitorTest.cc
* src/BtConstants.h
* src/BtContext.h: Added 'private' flag.
* src/BtExtendedMessage.{h, cc}
* test/BtExtendedMessageTest.cc
* src/BtHandshakeMessage.{h, cc}: Set extended messaging bit in
reserved field.
* test/BtHandshakeMessageTest.cc
* src/BtMessageFactory.h
* src/BtRegistry.h
* src/BtRuntime.h: This class holds default extension message
IDs for
aria2. By default, aria2 uses ID 8 for ut_pex.
* src/DefaultBtContext.cc
* src/DefaultBtInteractive.{h, cc}: This class holds
_utPexEnabled.
When it is true, aria2 enables ut_pex. This value is set by
PeerInteractionCommand.
* src/DefaultBtMessageFactory.{h, cc}
* test/DefaultBtMessageFactoryTest.cc
* src/DefaultBtMessageReceiver.cc: Moved the code of fast
extension
handling to DefaultBtInteractive class.
* src/DefaultExtensionMessageFactory.{h, cc}
* test/DefaultExtensionMessageFactoryTest.cc
* src/DefaultPeerStorage.cc: Returns false if a peer is already
in
the container(peers and incomingPeers. The equality is
determined by
Peer::id).
* test/DefaultPeerStorageTest.cc
* src/ExtensionMessage.h
* test/MockExtensionMessage.h
* src/ExtensionMessageFactory.h
* test/MockExtensionMessageFactory.h
* src/HandshakeExtensionMessage.{h, cc}
* test/HandshakeExtensionMessageTest.cc
* src/MetaEntry.h
* src/Peer.{h, cc}
* src/PeerInteractionCommand.cc
* src/PeerReceiveHandshakeCommand.cc: Evaluate the return value
of
addIncomingPeer.
* src/PeerMessageUtil.{h, cc}
* src/PeerObject.h
* src/UTPexExtensionMessage.{h, cc}
* test/UTPexExtensionMessageTest.cc
* src/message.h
* src/prefs.h
Fixed the bug that returns incomplete data when it contains null
character. A convenient constructor was also added.
* src/Data.{h, cc}
Rewritten.
* src/CompactPeerListProcessor.cc
Fixed typos.
* src/message.h
* src/MetaFileUtil.cc
2007-12-22 03:57:55 +00:00
|
|
|
} else {
|
2010-06-12 08:23:49 +00:00
|
|
|
throw DL_ABORT_EX("Received extended message from peer during"
|
|
|
|
" a session with extended messaging disabled.");
|
2007-12-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added uTorrent compatible Peer Exchange.
* src/BencodeVisitor.{h, cc}
* test/BencodeVisitorTest.cc
* src/BtConstants.h
* src/BtContext.h: Added 'private' flag.
* src/BtExtendedMessage.{h, cc}
* test/BtExtendedMessageTest.cc
* src/BtHandshakeMessage.{h, cc}: Set extended messaging bit in
reserved field.
* test/BtHandshakeMessageTest.cc
* src/BtMessageFactory.h
* src/BtRegistry.h
* src/BtRuntime.h: This class holds default extension message
IDs for
aria2. By default, aria2 uses ID 8 for ut_pex.
* src/DefaultBtContext.cc
* src/DefaultBtInteractive.{h, cc}: This class holds
_utPexEnabled.
When it is true, aria2 enables ut_pex. This value is set by
PeerInteractionCommand.
* src/DefaultBtMessageFactory.{h, cc}
* test/DefaultBtMessageFactoryTest.cc
* src/DefaultBtMessageReceiver.cc: Moved the code of fast
extension
handling to DefaultBtInteractive class.
* src/DefaultExtensionMessageFactory.{h, cc}
* test/DefaultExtensionMessageFactoryTest.cc
* src/DefaultPeerStorage.cc: Returns false if a peer is already
in
the container(peers and incomingPeers. The equality is
determined by
Peer::id).
* test/DefaultPeerStorageTest.cc
* src/ExtensionMessage.h
* test/MockExtensionMessage.h
* src/ExtensionMessageFactory.h
* test/MockExtensionMessageFactory.h
* src/HandshakeExtensionMessage.{h, cc}
* test/HandshakeExtensionMessageTest.cc
* src/MetaEntry.h
* src/Peer.{h, cc}
* src/PeerInteractionCommand.cc
* src/PeerReceiveHandshakeCommand.cc: Evaluate the return value
of
addIncomingPeer.
* src/PeerMessageUtil.{h, cc}
* src/PeerObject.h
* src/UTPexExtensionMessage.{h, cc}
* test/UTPexExtensionMessageTest.cc
* src/message.h
* src/prefs.h
Fixed the bug that returns incomplete data when it contains null
character. A convenient constructor was also added.
* src/Data.{h, cc}
Rewritten.
* src/CompactPeerListProcessor.cc
Fixed typos.
* src/message.h
* src/MetaFileUtil.cc
2007-12-22 03:57:55 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2006-12-24 06:25:21 +00:00
|
|
|
default:
|
2010-11-20 09:36:14 +00:00
|
|
|
throw DL_ABORT_EX(fmt("Invalid message ID. id=%u", id));
|
2006-12-24 06:25:21 +00:00
|
|
|
}
|
|
|
|
}
|
2012-09-27 14:40:25 +00:00
|
|
|
setCommonProperty(msg.get());
|
2006-12-24 06:25:21 +00:00
|
|
|
return msg;
|
|
|
|
}
|
|
|
|
|
2012-09-27 14:40:25 +00:00
|
|
|
void DefaultBtMessageFactory::setCommonProperty(AbstractBtMessage* msg)
|
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
msg->setCuid(cuid_);
|
|
|
|
msg->setPeer(peer_);
|
|
|
|
msg->setPieceStorage(pieceStorage_);
|
|
|
|
msg->setBtMessageDispatcher(dispatcher_);
|
|
|
|
msg->setBtRequestFactory(requestFactory_);
|
2010-11-12 12:48:48 +00:00
|
|
|
msg->setBtMessageFactory(this);
|
2010-06-21 13:51:56 +00:00
|
|
|
msg->setPeerConnection(peerConnection_);
|
|
|
|
if(metadataGetMode_) {
|
2009-11-22 14:52:17 +00:00
|
|
|
msg->enableMetadataGetMode();
|
|
|
|
}
|
2006-12-24 06:25:21 +00:00
|
|
|
}
|
|
|
|
|
2008-04-20 00:50:22 +00:00
|
|
|
SharedHandle<BtHandshakeMessage>
|
2010-06-12 08:23:49 +00:00
|
|
|
DefaultBtMessageFactory::createHandshakeMessage
|
|
|
|
(const unsigned char* data, size_t dataLength)
|
2006-12-24 06:25:21 +00:00
|
|
|
{
|
2010-06-12 08:23:49 +00:00
|
|
|
SharedHandle<BtHandshakeMessage> msg =
|
|
|
|
BtHandshakeMessage::create(data, dataLength);
|
2012-09-28 14:27:46 +00:00
|
|
|
SharedHandle<BtMessageValidator> validator
|
2009-06-28 10:37:15 +00:00
|
|
|
(new BtHandshakeMessageValidator
|
2010-06-21 13:51:56 +00:00
|
|
|
(msg.get(), bittorrent::getInfoHash(downloadContext_)));
|
2006-12-24 06:25:21 +00:00
|
|
|
msg->setBtMessageValidator(validator);
|
2012-09-27 14:40:25 +00:00
|
|
|
setCommonProperty(msg.get());
|
2006-12-24 06:25:21 +00:00
|
|
|
return msg;
|
|
|
|
}
|
|
|
|
|
2008-04-20 00:50:22 +00:00
|
|
|
SharedHandle<BtHandshakeMessage>
|
2006-12-24 06:25:21 +00:00
|
|
|
DefaultBtMessageFactory::createHandshakeMessage(const unsigned char* infoHash,
|
2010-01-05 16:01:46 +00:00
|
|
|
const unsigned char* peerId)
|
2006-12-24 06:25:21 +00:00
|
|
|
{
|
2010-06-12 08:23:49 +00:00
|
|
|
SharedHandle<BtHandshakeMessage> msg
|
|
|
|
(new BtHandshakeMessage(infoHash, peerId));
|
2010-06-21 13:51:56 +00:00
|
|
|
msg->setDHTEnabled(dhtEnabled_);
|
2012-09-27 14:40:25 +00:00
|
|
|
setCommonProperty(msg.get());
|
2006-12-24 06:25:21 +00:00
|
|
|
return msg;
|
|
|
|
}
|
|
|
|
|
2012-09-27 14:40:25 +00:00
|
|
|
SharedHandle<BtMessage>
|
2010-02-28 12:30:11 +00:00
|
|
|
DefaultBtMessageFactory::createRequestMessage
|
|
|
|
(const SharedHandle<Piece>& piece, size_t blockIndex)
|
2006-12-24 06:25:21 +00:00
|
|
|
{
|
2012-09-27 14:40:25 +00:00
|
|
|
BtRequestMessage* msg
|
2008-04-20 00:50:22 +00:00
|
|
|
(new BtRequestMessage(piece->getIndex(),
|
2010-01-05 16:01:46 +00:00
|
|
|
blockIndex*piece->getBlockLength(),
|
|
|
|
piece->getBlockLength(blockIndex),
|
|
|
|
blockIndex));
|
2006-12-24 06:25:21 +00:00
|
|
|
setCommonProperty(msg);
|
2012-09-27 14:40:25 +00:00
|
|
|
return SharedHandle<BtMessage>(msg);
|
2006-12-24 06:25:21 +00:00
|
|
|
}
|
|
|
|
|
2012-09-27 14:40:25 +00:00
|
|
|
SharedHandle<BtMessage>
|
2010-06-12 08:23:49 +00:00
|
|
|
DefaultBtMessageFactory::createCancelMessage
|
2011-12-07 15:51:20 +00:00
|
|
|
(size_t index, int32_t begin, int32_t length)
|
2006-12-24 06:25:21 +00:00
|
|
|
{
|
2012-09-27 14:40:25 +00:00
|
|
|
BtCancelMessage* msg(new BtCancelMessage(index, begin, length));
|
2006-12-24 06:25:21 +00:00
|
|
|
setCommonProperty(msg);
|
2012-09-27 14:40:25 +00:00
|
|
|
return SharedHandle<BtMessage>(msg);
|
2006-12-24 06:25:21 +00:00
|
|
|
}
|
|
|
|
|
2012-09-27 14:40:25 +00:00
|
|
|
SharedHandle<BtMessage>
|
2010-06-12 08:23:49 +00:00
|
|
|
DefaultBtMessageFactory::createPieceMessage
|
2011-12-07 15:51:20 +00:00
|
|
|
(size_t index, int32_t begin, int32_t length)
|
2006-12-24 06:25:21 +00:00
|
|
|
{
|
2012-09-27 14:40:25 +00:00
|
|
|
BtPieceMessage* msg(new BtPieceMessage(index, begin, length));
|
2010-06-21 13:51:56 +00:00
|
|
|
msg->setDownloadContext(downloadContext_);
|
2006-12-24 06:25:21 +00:00
|
|
|
setCommonProperty(msg);
|
2012-09-27 14:40:25 +00:00
|
|
|
return SharedHandle<BtMessage>(msg);
|
2006-12-24 06:25:21 +00:00
|
|
|
}
|
|
|
|
|
2012-09-27 14:40:25 +00:00
|
|
|
SharedHandle<BtMessage>
|
2008-03-09 12:24:01 +00:00
|
|
|
DefaultBtMessageFactory::createHaveMessage(size_t index)
|
2006-12-24 06:25:21 +00:00
|
|
|
{
|
2012-09-27 14:40:25 +00:00
|
|
|
BtHaveMessage* msg(new BtHaveMessage(index));
|
2006-12-24 06:25:21 +00:00
|
|
|
setCommonProperty(msg);
|
2012-09-27 14:40:25 +00:00
|
|
|
return SharedHandle<BtMessage>(msg);
|
2006-12-24 06:25:21 +00:00
|
|
|
}
|
|
|
|
|
2012-09-27 14:40:25 +00:00
|
|
|
SharedHandle<BtMessage>
|
2006-12-24 06:25:21 +00:00
|
|
|
DefaultBtMessageFactory::createChokeMessage()
|
|
|
|
{
|
2012-09-27 14:40:25 +00:00
|
|
|
BtChokeMessage* msg(new BtChokeMessage());
|
2006-12-24 06:25:21 +00:00
|
|
|
setCommonProperty(msg);
|
2012-09-27 14:40:25 +00:00
|
|
|
return SharedHandle<BtMessage>(msg);
|
2006-12-24 06:25:21 +00:00
|
|
|
}
|
|
|
|
|
2012-09-27 14:40:25 +00:00
|
|
|
SharedHandle<BtMessage>
|
2006-12-24 06:25:21 +00:00
|
|
|
DefaultBtMessageFactory::createUnchokeMessage()
|
|
|
|
{
|
2012-09-27 14:40:25 +00:00
|
|
|
BtUnchokeMessage* msg(new BtUnchokeMessage());
|
2006-12-24 06:25:21 +00:00
|
|
|
setCommonProperty(msg);
|
2012-09-27 14:40:25 +00:00
|
|
|
return SharedHandle<BtMessage>(msg);
|
2006-12-24 06:25:21 +00:00
|
|
|
}
|
2012-09-27 14:40:25 +00:00
|
|
|
|
|
|
|
SharedHandle<BtMessage>
|
2006-12-24 06:25:21 +00:00
|
|
|
DefaultBtMessageFactory::createInterestedMessage()
|
|
|
|
{
|
2012-09-27 14:40:25 +00:00
|
|
|
BtInterestedMessage* msg(new BtInterestedMessage());
|
2006-12-24 06:25:21 +00:00
|
|
|
setCommonProperty(msg);
|
2012-09-27 14:40:25 +00:00
|
|
|
return SharedHandle<BtMessage>(msg);
|
2006-12-24 06:25:21 +00:00
|
|
|
}
|
|
|
|
|
2012-09-27 14:40:25 +00:00
|
|
|
SharedHandle<BtMessage>
|
2006-12-24 06:25:21 +00:00
|
|
|
DefaultBtMessageFactory::createNotInterestedMessage()
|
|
|
|
{
|
2012-09-27 14:40:25 +00:00
|
|
|
BtNotInterestedMessage* msg(new BtNotInterestedMessage());
|
2006-12-24 06:25:21 +00:00
|
|
|
setCommonProperty(msg);
|
2012-09-27 14:40:25 +00:00
|
|
|
return SharedHandle<BtMessage>(msg);
|
2006-12-24 06:25:21 +00:00
|
|
|
}
|
|
|
|
|
2012-09-27 14:40:25 +00:00
|
|
|
SharedHandle<BtMessage>
|
2006-12-24 06:25:21 +00:00
|
|
|
DefaultBtMessageFactory::createBitfieldMessage()
|
|
|
|
{
|
2012-09-27 14:40:25 +00:00
|
|
|
BtBitfieldMessage* msg
|
2010-06-21 13:51:56 +00:00
|
|
|
(new BtBitfieldMessage(pieceStorage_->getBitfield(),
|
|
|
|
pieceStorage_->getBitfieldLength()));
|
2006-12-24 06:25:21 +00:00
|
|
|
setCommonProperty(msg);
|
2012-09-27 14:40:25 +00:00
|
|
|
return SharedHandle<BtMessage>(msg);
|
2006-12-24 06:25:21 +00:00
|
|
|
}
|
|
|
|
|
2012-09-27 14:40:25 +00:00
|
|
|
SharedHandle<BtMessage>
|
2006-12-24 06:25:21 +00:00
|
|
|
DefaultBtMessageFactory::createKeepAliveMessage()
|
|
|
|
{
|
2012-09-27 14:40:25 +00:00
|
|
|
BtKeepAliveMessage* msg(new BtKeepAliveMessage());
|
2006-12-24 06:25:21 +00:00
|
|
|
setCommonProperty(msg);
|
2012-09-27 14:40:25 +00:00
|
|
|
return SharedHandle<BtMessage>(msg);
|
|
|
|
}
|
2006-12-24 06:25:21 +00:00
|
|
|
|
2012-09-27 14:40:25 +00:00
|
|
|
SharedHandle<BtMessage>
|
2006-12-24 06:25:21 +00:00
|
|
|
DefaultBtMessageFactory::createHaveAllMessage()
|
|
|
|
{
|
2012-09-27 14:40:25 +00:00
|
|
|
BtHaveAllMessage* msg(new BtHaveAllMessage());
|
2006-12-24 06:25:21 +00:00
|
|
|
setCommonProperty(msg);
|
2012-09-27 14:40:25 +00:00
|
|
|
return SharedHandle<BtMessage>(msg);
|
2006-12-24 06:25:21 +00:00
|
|
|
}
|
|
|
|
|
2012-09-27 14:40:25 +00:00
|
|
|
SharedHandle<BtMessage>
|
2006-12-24 06:25:21 +00:00
|
|
|
DefaultBtMessageFactory::createHaveNoneMessage()
|
|
|
|
{
|
2012-09-27 14:40:25 +00:00
|
|
|
BtHaveNoneMessage* msg(new BtHaveNoneMessage());
|
2006-12-24 06:25:21 +00:00
|
|
|
setCommonProperty(msg);
|
2012-09-27 14:40:25 +00:00
|
|
|
return SharedHandle<BtMessage>(msg);
|
2006-12-24 06:25:21 +00:00
|
|
|
}
|
|
|
|
|
2012-09-27 14:40:25 +00:00
|
|
|
SharedHandle<BtMessage>
|
2010-06-12 08:23:49 +00:00
|
|
|
DefaultBtMessageFactory::createRejectMessage
|
2011-12-07 15:51:20 +00:00
|
|
|
(size_t index, int32_t begin, int32_t length)
|
2006-12-24 06:25:21 +00:00
|
|
|
{
|
2012-09-27 14:40:25 +00:00
|
|
|
BtRejectMessage* msg(new BtRejectMessage(index, begin, length));
|
2006-12-24 06:25:21 +00:00
|
|
|
setCommonProperty(msg);
|
2012-09-27 14:40:25 +00:00
|
|
|
return SharedHandle<BtMessage>(msg);
|
2006-12-24 06:25:21 +00:00
|
|
|
}
|
|
|
|
|
2012-09-27 14:40:25 +00:00
|
|
|
SharedHandle<BtMessage>
|
2008-03-09 12:24:01 +00:00
|
|
|
DefaultBtMessageFactory::createAllowedFastMessage(size_t index)
|
2006-12-24 06:25:21 +00:00
|
|
|
{
|
2012-09-27 14:40:25 +00:00
|
|
|
BtAllowedFastMessage* msg(new BtAllowedFastMessage(index));
|
2006-12-24 06:25:21 +00:00
|
|
|
setCommonProperty(msg);
|
2012-09-27 14:40:25 +00:00
|
|
|
return SharedHandle<BtMessage>(msg);
|
2006-12-24 06:25:21 +00:00
|
|
|
}
|
2007-12-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added uTorrent compatible Peer Exchange.
* src/BencodeVisitor.{h, cc}
* test/BencodeVisitorTest.cc
* src/BtConstants.h
* src/BtContext.h: Added 'private' flag.
* src/BtExtendedMessage.{h, cc}
* test/BtExtendedMessageTest.cc
* src/BtHandshakeMessage.{h, cc}: Set extended messaging bit in
reserved field.
* test/BtHandshakeMessageTest.cc
* src/BtMessageFactory.h
* src/BtRegistry.h
* src/BtRuntime.h: This class holds default extension message
IDs for
aria2. By default, aria2 uses ID 8 for ut_pex.
* src/DefaultBtContext.cc
* src/DefaultBtInteractive.{h, cc}: This class holds
_utPexEnabled.
When it is true, aria2 enables ut_pex. This value is set by
PeerInteractionCommand.
* src/DefaultBtMessageFactory.{h, cc}
* test/DefaultBtMessageFactoryTest.cc
* src/DefaultBtMessageReceiver.cc: Moved the code of fast
extension
handling to DefaultBtInteractive class.
* src/DefaultExtensionMessageFactory.{h, cc}
* test/DefaultExtensionMessageFactoryTest.cc
* src/DefaultPeerStorage.cc: Returns false if a peer is already
in
the container(peers and incomingPeers. The equality is
determined by
Peer::id).
* test/DefaultPeerStorageTest.cc
* src/ExtensionMessage.h
* test/MockExtensionMessage.h
* src/ExtensionMessageFactory.h
* test/MockExtensionMessageFactory.h
* src/HandshakeExtensionMessage.{h, cc}
* test/HandshakeExtensionMessageTest.cc
* src/MetaEntry.h
* src/Peer.{h, cc}
* src/PeerInteractionCommand.cc
* src/PeerReceiveHandshakeCommand.cc: Evaluate the return value
of
addIncomingPeer.
* src/PeerMessageUtil.{h, cc}
* src/PeerObject.h
* src/UTPexExtensionMessage.{h, cc}
* test/UTPexExtensionMessageTest.cc
* src/message.h
* src/prefs.h
Fixed the bug that returns incomplete data when it contains null
character. A convenient constructor was also added.
* src/Data.{h, cc}
Rewritten.
* src/CompactPeerListProcessor.cc
Fixed typos.
* src/message.h
* src/MetaFileUtil.cc
2007-12-22 03:57:55 +00:00
|
|
|
|
2012-09-27 14:40:25 +00:00
|
|
|
SharedHandle<BtMessage>
|
2008-02-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added DHT functionality, compatible with mainline.
DHT is disabled by default. To enable it, give --enable-dht to
aria2c.
You may need to specify entry point to DHT network using
--dht-entry-point. DHT uses UDP port to listen incoming message.
Use --dht-listen-port to specify port number. Make sure that
your
firewall configuration can pass through UDP traffic to the port.
The routing table is saved in $HOME/.aria2/dht.dat.
* src/DHT*
* src/BNode.{h, cc}
* src/PeerInteractionCommand.cc: enable DHT functionality for a
particular torrent.
* src/Data.cc: Rewritten ctor.
* src/OptionHandlerFactory.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/DefaultBtInteractive.cc: Send port message if dht is
enabled.
* src/RequestGroup.cc: Initialize DHT functionality. When
download
ends, remove BtContext from DHTPeerAnnounceStorage.
* src/BtPortMessage.{h, cc}: Rewritten.
* src/message.h
* src/OptionHandlerImpl.cc
* src/option_processing.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/Dictionary.{h, cc} (remove): New function.
* src/prefs.h
* src/DefaultBtMessageFactory.h
* src/BtHandshakeMessage.cc
* src/ActivePeerConnectionCommand.cc
* src/SocketCore.{h, cc}: Added datagram socket support.
* src/DefaultBtMessageFactory.cc
* src/BtSetup.cc: Add BtContext to DHTPeerAnnounceStorage here.
Create DHT commands.
* src/BtMessageFactory.h
* src/PeerMessageUtil.{h, cc}
2008-02-01 17:36:33 +00:00
|
|
|
DefaultBtMessageFactory::createPortMessage(uint16_t port)
|
|
|
|
{
|
2012-09-27 14:40:25 +00:00
|
|
|
BtPortMessage* msg(new BtPortMessage(port));
|
2008-02-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added DHT functionality, compatible with mainline.
DHT is disabled by default. To enable it, give --enable-dht to
aria2c.
You may need to specify entry point to DHT network using
--dht-entry-point. DHT uses UDP port to listen incoming message.
Use --dht-listen-port to specify port number. Make sure that
your
firewall configuration can pass through UDP traffic to the port.
The routing table is saved in $HOME/.aria2/dht.dat.
* src/DHT*
* src/BNode.{h, cc}
* src/PeerInteractionCommand.cc: enable DHT functionality for a
particular torrent.
* src/Data.cc: Rewritten ctor.
* src/OptionHandlerFactory.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/DefaultBtInteractive.cc: Send port message if dht is
enabled.
* src/RequestGroup.cc: Initialize DHT functionality. When
download
ends, remove BtContext from DHTPeerAnnounceStorage.
* src/BtPortMessage.{h, cc}: Rewritten.
* src/message.h
* src/OptionHandlerImpl.cc
* src/option_processing.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/Dictionary.{h, cc} (remove): New function.
* src/prefs.h
* src/DefaultBtMessageFactory.h
* src/BtHandshakeMessage.cc
* src/ActivePeerConnectionCommand.cc
* src/SocketCore.{h, cc}: Added datagram socket support.
* src/DefaultBtMessageFactory.cc
* src/BtSetup.cc: Add BtContext to DHTPeerAnnounceStorage here.
Create DHT commands.
* src/BtMessageFactory.h
* src/PeerMessageUtil.{h, cc}
2008-02-01 17:36:33 +00:00
|
|
|
setCommonProperty(msg);
|
2012-09-27 14:40:25 +00:00
|
|
|
return SharedHandle<BtMessage>(msg);
|
2008-02-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added DHT functionality, compatible with mainline.
DHT is disabled by default. To enable it, give --enable-dht to
aria2c.
You may need to specify entry point to DHT network using
--dht-entry-point. DHT uses UDP port to listen incoming message.
Use --dht-listen-port to specify port number. Make sure that
your
firewall configuration can pass through UDP traffic to the port.
The routing table is saved in $HOME/.aria2/dht.dat.
* src/DHT*
* src/BNode.{h, cc}
* src/PeerInteractionCommand.cc: enable DHT functionality for a
particular torrent.
* src/Data.cc: Rewritten ctor.
* src/OptionHandlerFactory.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/DefaultBtInteractive.cc: Send port message if dht is
enabled.
* src/RequestGroup.cc: Initialize DHT functionality. When
download
ends, remove BtContext from DHTPeerAnnounceStorage.
* src/BtPortMessage.{h, cc}: Rewritten.
* src/message.h
* src/OptionHandlerImpl.cc
* src/option_processing.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/Dictionary.{h, cc} (remove): New function.
* src/prefs.h
* src/DefaultBtMessageFactory.h
* src/BtHandshakeMessage.cc
* src/ActivePeerConnectionCommand.cc
* src/SocketCore.{h, cc}: Added datagram socket support.
* src/DefaultBtMessageFactory.cc
* src/BtSetup.cc: Add BtContext to DHTPeerAnnounceStorage here.
Create DHT commands.
* src/BtMessageFactory.h
* src/PeerMessageUtil.{h, cc}
2008-02-01 17:36:33 +00:00
|
|
|
}
|
|
|
|
|
2012-09-27 14:40:25 +00:00
|
|
|
SharedHandle<BtMessage>
|
2010-06-12 08:23:49 +00:00
|
|
|
DefaultBtMessageFactory::createBtExtendedMessage
|
2012-09-28 14:27:46 +00:00
|
|
|
(const SharedHandle<ExtensionMessage>& msg)
|
2007-12-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added uTorrent compatible Peer Exchange.
* src/BencodeVisitor.{h, cc}
* test/BencodeVisitorTest.cc
* src/BtConstants.h
* src/BtContext.h: Added 'private' flag.
* src/BtExtendedMessage.{h, cc}
* test/BtExtendedMessageTest.cc
* src/BtHandshakeMessage.{h, cc}: Set extended messaging bit in
reserved field.
* test/BtHandshakeMessageTest.cc
* src/BtMessageFactory.h
* src/BtRegistry.h
* src/BtRuntime.h: This class holds default extension message
IDs for
aria2. By default, aria2 uses ID 8 for ut_pex.
* src/DefaultBtContext.cc
* src/DefaultBtInteractive.{h, cc}: This class holds
_utPexEnabled.
When it is true, aria2 enables ut_pex. This value is set by
PeerInteractionCommand.
* src/DefaultBtMessageFactory.{h, cc}
* test/DefaultBtMessageFactoryTest.cc
* src/DefaultBtMessageReceiver.cc: Moved the code of fast
extension
handling to DefaultBtInteractive class.
* src/DefaultExtensionMessageFactory.{h, cc}
* test/DefaultExtensionMessageFactoryTest.cc
* src/DefaultPeerStorage.cc: Returns false if a peer is already
in
the container(peers and incomingPeers. The equality is
determined by
Peer::id).
* test/DefaultPeerStorageTest.cc
* src/ExtensionMessage.h
* test/MockExtensionMessage.h
* src/ExtensionMessageFactory.h
* test/MockExtensionMessageFactory.h
* src/HandshakeExtensionMessage.{h, cc}
* test/HandshakeExtensionMessageTest.cc
* src/MetaEntry.h
* src/Peer.{h, cc}
* src/PeerInteractionCommand.cc
* src/PeerReceiveHandshakeCommand.cc: Evaluate the return value
of
addIncomingPeer.
* src/PeerMessageUtil.{h, cc}
* src/PeerObject.h
* src/UTPexExtensionMessage.{h, cc}
* test/UTPexExtensionMessageTest.cc
* src/message.h
* src/prefs.h
Fixed the bug that returns incomplete data when it contains null
character. A convenient constructor was also added.
* src/Data.{h, cc}
Rewritten.
* src/CompactPeerListProcessor.cc
Fixed typos.
* src/message.h
* src/MetaFileUtil.cc
2007-12-22 03:57:55 +00:00
|
|
|
{
|
2012-09-27 14:40:25 +00:00
|
|
|
BtExtendedMessage* m(new BtExtendedMessage(msg));
|
2007-12-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added uTorrent compatible Peer Exchange.
* src/BencodeVisitor.{h, cc}
* test/BencodeVisitorTest.cc
* src/BtConstants.h
* src/BtContext.h: Added 'private' flag.
* src/BtExtendedMessage.{h, cc}
* test/BtExtendedMessageTest.cc
* src/BtHandshakeMessage.{h, cc}: Set extended messaging bit in
reserved field.
* test/BtHandshakeMessageTest.cc
* src/BtMessageFactory.h
* src/BtRegistry.h
* src/BtRuntime.h: This class holds default extension message
IDs for
aria2. By default, aria2 uses ID 8 for ut_pex.
* src/DefaultBtContext.cc
* src/DefaultBtInteractive.{h, cc}: This class holds
_utPexEnabled.
When it is true, aria2 enables ut_pex. This value is set by
PeerInteractionCommand.
* src/DefaultBtMessageFactory.{h, cc}
* test/DefaultBtMessageFactoryTest.cc
* src/DefaultBtMessageReceiver.cc: Moved the code of fast
extension
handling to DefaultBtInteractive class.
* src/DefaultExtensionMessageFactory.{h, cc}
* test/DefaultExtensionMessageFactoryTest.cc
* src/DefaultPeerStorage.cc: Returns false if a peer is already
in
the container(peers and incomingPeers. The equality is
determined by
Peer::id).
* test/DefaultPeerStorageTest.cc
* src/ExtensionMessage.h
* test/MockExtensionMessage.h
* src/ExtensionMessageFactory.h
* test/MockExtensionMessageFactory.h
* src/HandshakeExtensionMessage.{h, cc}
* test/HandshakeExtensionMessageTest.cc
* src/MetaEntry.h
* src/Peer.{h, cc}
* src/PeerInteractionCommand.cc
* src/PeerReceiveHandshakeCommand.cc: Evaluate the return value
of
addIncomingPeer.
* src/PeerMessageUtil.{h, cc}
* src/PeerObject.h
* src/UTPexExtensionMessage.{h, cc}
* test/UTPexExtensionMessageTest.cc
* src/message.h
* src/prefs.h
Fixed the bug that returns incomplete data when it contains null
character. A convenient constructor was also added.
* src/Data.{h, cc}
Rewritten.
* src/CompactPeerListProcessor.cc
Fixed typos.
* src/message.h
* src/MetaFileUtil.cc
2007-12-22 03:57:55 +00:00
|
|
|
setCommonProperty(m);
|
2012-09-27 14:40:25 +00:00
|
|
|
return SharedHandle<BtMessage>(m);
|
2007-12-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added uTorrent compatible Peer Exchange.
* src/BencodeVisitor.{h, cc}
* test/BencodeVisitorTest.cc
* src/BtConstants.h
* src/BtContext.h: Added 'private' flag.
* src/BtExtendedMessage.{h, cc}
* test/BtExtendedMessageTest.cc
* src/BtHandshakeMessage.{h, cc}: Set extended messaging bit in
reserved field.
* test/BtHandshakeMessageTest.cc
* src/BtMessageFactory.h
* src/BtRegistry.h
* src/BtRuntime.h: This class holds default extension message
IDs for
aria2. By default, aria2 uses ID 8 for ut_pex.
* src/DefaultBtContext.cc
* src/DefaultBtInteractive.{h, cc}: This class holds
_utPexEnabled.
When it is true, aria2 enables ut_pex. This value is set by
PeerInteractionCommand.
* src/DefaultBtMessageFactory.{h, cc}
* test/DefaultBtMessageFactoryTest.cc
* src/DefaultBtMessageReceiver.cc: Moved the code of fast
extension
handling to DefaultBtInteractive class.
* src/DefaultExtensionMessageFactory.{h, cc}
* test/DefaultExtensionMessageFactoryTest.cc
* src/DefaultPeerStorage.cc: Returns false if a peer is already
in
the container(peers and incomingPeers. The equality is
determined by
Peer::id).
* test/DefaultPeerStorageTest.cc
* src/ExtensionMessage.h
* test/MockExtensionMessage.h
* src/ExtensionMessageFactory.h
* test/MockExtensionMessageFactory.h
* src/HandshakeExtensionMessage.{h, cc}
* test/HandshakeExtensionMessageTest.cc
* src/MetaEntry.h
* src/Peer.{h, cc}
* src/PeerInteractionCommand.cc
* src/PeerReceiveHandshakeCommand.cc: Evaluate the return value
of
addIncomingPeer.
* src/PeerMessageUtil.{h, cc}
* src/PeerObject.h
* src/UTPexExtensionMessage.{h, cc}
* test/UTPexExtensionMessageTest.cc
* src/message.h
* src/prefs.h
Fixed the bug that returns incomplete data when it contains null
character. A convenient constructor was also added.
* src/Data.{h, cc}
Rewritten.
* src/CompactPeerListProcessor.cc
Fixed typos.
* src/message.h
* src/MetaFileUtil.cc
2007-12-22 03:57:55 +00:00
|
|
|
}
|
2008-02-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added DHT functionality, compatible with mainline.
DHT is disabled by default. To enable it, give --enable-dht to
aria2c.
You may need to specify entry point to DHT network using
--dht-entry-point. DHT uses UDP port to listen incoming message.
Use --dht-listen-port to specify port number. Make sure that
your
firewall configuration can pass through UDP traffic to the port.
The routing table is saved in $HOME/.aria2/dht.dat.
* src/DHT*
* src/BNode.{h, cc}
* src/PeerInteractionCommand.cc: enable DHT functionality for a
particular torrent.
* src/Data.cc: Rewritten ctor.
* src/OptionHandlerFactory.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/DefaultBtInteractive.cc: Send port message if dht is
enabled.
* src/RequestGroup.cc: Initialize DHT functionality. When
download
ends, remove BtContext from DHTPeerAnnounceStorage.
* src/BtPortMessage.{h, cc}: Rewritten.
* src/message.h
* src/OptionHandlerImpl.cc
* src/option_processing.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/Dictionary.{h, cc} (remove): New function.
* src/prefs.h
* src/DefaultBtMessageFactory.h
* src/BtHandshakeMessage.cc
* src/ActivePeerConnectionCommand.cc
* src/SocketCore.{h, cc}: Added datagram socket support.
* src/DefaultBtMessageFactory.cc
* src/BtSetup.cc: Add BtContext to DHTPeerAnnounceStorage here.
Create DHT commands.
* src/BtMessageFactory.h
* src/PeerMessageUtil.{h, cc}
2008-02-01 17:36:33 +00:00
|
|
|
|
2010-11-12 12:48:48 +00:00
|
|
|
void DefaultBtMessageFactory::setTaskQueue(DHTTaskQueue* taskQueue)
|
2008-02-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added DHT functionality, compatible with mainline.
DHT is disabled by default. To enable it, give --enable-dht to
aria2c.
You may need to specify entry point to DHT network using
--dht-entry-point. DHT uses UDP port to listen incoming message.
Use --dht-listen-port to specify port number. Make sure that
your
firewall configuration can pass through UDP traffic to the port.
The routing table is saved in $HOME/.aria2/dht.dat.
* src/DHT*
* src/BNode.{h, cc}
* src/PeerInteractionCommand.cc: enable DHT functionality for a
particular torrent.
* src/Data.cc: Rewritten ctor.
* src/OptionHandlerFactory.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/DefaultBtInteractive.cc: Send port message if dht is
enabled.
* src/RequestGroup.cc: Initialize DHT functionality. When
download
ends, remove BtContext from DHTPeerAnnounceStorage.
* src/BtPortMessage.{h, cc}: Rewritten.
* src/message.h
* src/OptionHandlerImpl.cc
* src/option_processing.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/Dictionary.{h, cc} (remove): New function.
* src/prefs.h
* src/DefaultBtMessageFactory.h
* src/BtHandshakeMessage.cc
* src/ActivePeerConnectionCommand.cc
* src/SocketCore.{h, cc}: Added datagram socket support.
* src/DefaultBtMessageFactory.cc
* src/BtSetup.cc: Add BtContext to DHTPeerAnnounceStorage here.
Create DHT commands.
* src/BtMessageFactory.h
* src/PeerMessageUtil.{h, cc}
2008-02-01 17:36:33 +00:00
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
taskQueue_ = taskQueue;
|
2008-02-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added DHT functionality, compatible with mainline.
DHT is disabled by default. To enable it, give --enable-dht to
aria2c.
You may need to specify entry point to DHT network using
--dht-entry-point. DHT uses UDP port to listen incoming message.
Use --dht-listen-port to specify port number. Make sure that
your
firewall configuration can pass through UDP traffic to the port.
The routing table is saved in $HOME/.aria2/dht.dat.
* src/DHT*
* src/BNode.{h, cc}
* src/PeerInteractionCommand.cc: enable DHT functionality for a
particular torrent.
* src/Data.cc: Rewritten ctor.
* src/OptionHandlerFactory.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/DefaultBtInteractive.cc: Send port message if dht is
enabled.
* src/RequestGroup.cc: Initialize DHT functionality. When
download
ends, remove BtContext from DHTPeerAnnounceStorage.
* src/BtPortMessage.{h, cc}: Rewritten.
* src/message.h
* src/OptionHandlerImpl.cc
* src/option_processing.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/Dictionary.{h, cc} (remove): New function.
* src/prefs.h
* src/DefaultBtMessageFactory.h
* src/BtHandshakeMessage.cc
* src/ActivePeerConnectionCommand.cc
* src/SocketCore.{h, cc}: Added datagram socket support.
* src/DefaultBtMessageFactory.cc
* src/BtSetup.cc: Add BtContext to DHTPeerAnnounceStorage here.
Create DHT commands.
* src/BtMessageFactory.h
* src/PeerMessageUtil.{h, cc}
2008-02-01 17:36:33 +00:00
|
|
|
}
|
|
|
|
|
2010-11-12 12:48:48 +00:00
|
|
|
void DefaultBtMessageFactory::setTaskFactory(DHTTaskFactory* taskFactory)
|
2008-02-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added DHT functionality, compatible with mainline.
DHT is disabled by default. To enable it, give --enable-dht to
aria2c.
You may need to specify entry point to DHT network using
--dht-entry-point. DHT uses UDP port to listen incoming message.
Use --dht-listen-port to specify port number. Make sure that
your
firewall configuration can pass through UDP traffic to the port.
The routing table is saved in $HOME/.aria2/dht.dat.
* src/DHT*
* src/BNode.{h, cc}
* src/PeerInteractionCommand.cc: enable DHT functionality for a
particular torrent.
* src/Data.cc: Rewritten ctor.
* src/OptionHandlerFactory.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/DefaultBtInteractive.cc: Send port message if dht is
enabled.
* src/RequestGroup.cc: Initialize DHT functionality. When
download
ends, remove BtContext from DHTPeerAnnounceStorage.
* src/BtPortMessage.{h, cc}: Rewritten.
* src/message.h
* src/OptionHandlerImpl.cc
* src/option_processing.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/Dictionary.{h, cc} (remove): New function.
* src/prefs.h
* src/DefaultBtMessageFactory.h
* src/BtHandshakeMessage.cc
* src/ActivePeerConnectionCommand.cc
* src/SocketCore.{h, cc}: Added datagram socket support.
* src/DefaultBtMessageFactory.cc
* src/BtSetup.cc: Add BtContext to DHTPeerAnnounceStorage here.
Create DHT commands.
* src/BtMessageFactory.h
* src/PeerMessageUtil.{h, cc}
2008-02-01 17:36:33 +00:00
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
taskFactory_ = taskFactory;
|
2008-02-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added DHT functionality, compatible with mainline.
DHT is disabled by default. To enable it, give --enable-dht to
aria2c.
You may need to specify entry point to DHT network using
--dht-entry-point. DHT uses UDP port to listen incoming message.
Use --dht-listen-port to specify port number. Make sure that
your
firewall configuration can pass through UDP traffic to the port.
The routing table is saved in $HOME/.aria2/dht.dat.
* src/DHT*
* src/BNode.{h, cc}
* src/PeerInteractionCommand.cc: enable DHT functionality for a
particular torrent.
* src/Data.cc: Rewritten ctor.
* src/OptionHandlerFactory.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/DefaultBtInteractive.cc: Send port message if dht is
enabled.
* src/RequestGroup.cc: Initialize DHT functionality. When
download
ends, remove BtContext from DHTPeerAnnounceStorage.
* src/BtPortMessage.{h, cc}: Rewritten.
* src/message.h
* src/OptionHandlerImpl.cc
* src/option_processing.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/Dictionary.{h, cc} (remove): New function.
* src/prefs.h
* src/DefaultBtMessageFactory.h
* src/BtHandshakeMessage.cc
* src/ActivePeerConnectionCommand.cc
* src/SocketCore.{h, cc}: Added datagram socket support.
* src/DefaultBtMessageFactory.cc
* src/BtSetup.cc: Add BtContext to DHTPeerAnnounceStorage here.
Create DHT commands.
* src/BtMessageFactory.h
* src/PeerMessageUtil.{h, cc}
2008-02-01 17:36:33 +00:00
|
|
|
}
|
2008-02-08 15:53:45 +00:00
|
|
|
|
|
|
|
void DefaultBtMessageFactory::setPeer(const SharedHandle<Peer>& peer)
|
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
peer_ = peer;
|
2008-02-08 15:53:45 +00:00
|
|
|
}
|
|
|
|
|
2009-06-28 10:37:15 +00:00
|
|
|
void DefaultBtMessageFactory::setDownloadContext
|
|
|
|
(const SharedHandle<DownloadContext>& downloadContext)
|
2008-02-08 15:53:45 +00:00
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
downloadContext_ = downloadContext;
|
2008-11-03 06:49:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DefaultBtMessageFactory::setPieceStorage
|
|
|
|
(const SharedHandle<PieceStorage>& pieceStorage)
|
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
pieceStorage_ = pieceStorage;
|
2008-11-03 06:49:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DefaultBtMessageFactory::setPeerStorage
|
|
|
|
(const SharedHandle<PeerStorage>& peerStorage)
|
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
peerStorage_ = peerStorage;
|
2008-02-08 15:53:45 +00:00
|
|
|
}
|
|
|
|
|
2010-06-12 08:23:49 +00:00
|
|
|
void DefaultBtMessageFactory::setBtMessageDispatcher
|
2010-11-12 12:48:48 +00:00
|
|
|
(BtMessageDispatcher* dispatcher)
|
2008-02-08 15:53:45 +00:00
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
dispatcher_ = dispatcher;
|
2008-02-08 15:53:45 +00:00
|
|
|
}
|
2008-02-10 15:57:00 +00:00
|
|
|
|
2008-11-03 06:49:02 +00:00
|
|
|
void DefaultBtMessageFactory::setExtensionMessageFactory
|
|
|
|
(const SharedHandle<ExtensionMessageFactory>& factory)
|
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
extensionMessageFactory_ = factory;
|
2008-11-03 06:49:02 +00:00
|
|
|
}
|
|
|
|
|
2010-11-12 12:48:48 +00:00
|
|
|
void DefaultBtMessageFactory::setLocalNode(DHTNode* localNode)
|
2008-02-10 15:57:00 +00:00
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
localNode_ = localNode;
|
2008-02-10 15:57:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-12 12:48:48 +00:00
|
|
|
void DefaultBtMessageFactory::setRoutingTable(DHTRoutingTable* routingTable)
|
2008-02-10 15:57:00 +00:00
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
routingTable_ = routingTable;
|
2008-02-10 15:57:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-12 12:48:48 +00:00
|
|
|
void DefaultBtMessageFactory::setBtRequestFactory(BtRequestFactory* factory)
|
2008-02-08 15:53:45 +00:00
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
requestFactory_ = factory;
|
2008-02-08 15:53:45 +00:00
|
|
|
}
|
|
|
|
|
2010-11-12 12:48:48 +00:00
|
|
|
void DefaultBtMessageFactory::setPeerConnection(PeerConnection* connection)
|
2008-02-08 15:53:45 +00:00
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
peerConnection_ = connection;
|
2008-02-08 15:53:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace aria2
|