summaryrefslogtreecommitdiff
path: root/src/DHTPeerLookupTask.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-07-21 23:42:41 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-07-21 23:42:41 +0900
commitc58f736bb91f55fb68151c5c7d977911f993b1ab (patch)
tree98dda8e77c825244f4d43cacc9951c7deaed2666 /src/DHTPeerLookupTask.cc
parentf0cd83f809ea679ab035f5827dba93a3ee25c59b (diff)
BtRegistry now holds BitTorrent TCP server port.
Because BitTorrent TCP server port is global configuration, it is not preferable that per download resource BtRuntime holds it. We also refactored and eliminated ugly static variable in PeerListenCommand. If TCP port is necessary, we inject it to them directly.
Diffstat (limited to 'src/DHTPeerLookupTask.cc')
-rw-r--r--src/DHTPeerLookupTask.cc14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/DHTPeerLookupTask.cc b/src/DHTPeerLookupTask.cc
index b3b080cb..0beaf998 100644
--- a/src/DHTPeerLookupTask.cc
+++ b/src/DHTPeerLookupTask.cc
@@ -43,7 +43,6 @@
#include "DHTMessageDispatcher.h"
#include "DHTMessageCallback.h"
#include "PeerStorage.h"
-#include "BtRuntime.h"
#include "util.h"
#include "DHTBucket.h"
#include "bittorrent_helper.h"
@@ -54,9 +53,11 @@
namespace aria2 {
DHTPeerLookupTask::DHTPeerLookupTask
-(const SharedHandle<DownloadContext>& downloadContext)
+(const SharedHandle<DownloadContext>& downloadContext,
+ uint16_t tcpPort)
: DHTAbstractNodeLookupTask<DHTGetPeersReplyMessage>
- (bittorrent::getInfoHash(downloadContext))
+ (bittorrent::getInfoHash(downloadContext)),
+ tcpPort_(tcpPort)
{}
void
@@ -115,18 +116,13 @@ void DHTPeerLookupTask::onFinish()
getMessageFactory()->createAnnouncePeerMessage
(node,
getTargetID(), // this is infoHash
- btRuntime_->getListenPort(),
+ tcpPort_,
token);
getMessageDispatcher()->addMessageToQueue(m);
--num;
}
}
-void DHTPeerLookupTask::setBtRuntime(const SharedHandle<BtRuntime>& btRuntime)
-{
- btRuntime_ = btRuntime;
-}
-
void DHTPeerLookupTask::setPeerStorage(const SharedHandle<PeerStorage>& ps)
{
peerStorage_ = ps;