diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-07-21 23:42:41 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-07-21 23:42:41 +0900 |
| commit | c58f736bb91f55fb68151c5c7d977911f993b1ab (patch) | |
| tree | 98dda8e77c825244f4d43cacc9951c7deaed2666 /src/DefaultBtAnnounce.cc | |
| parent | f0cd83f809ea679ab035f5827dba93a3ee25c59b (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/DefaultBtAnnounce.cc')
| -rw-r--r-- | src/DefaultBtAnnounce.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/DefaultBtAnnounce.cc b/src/DefaultBtAnnounce.cc index fa0ad96f..0f0efa86 100644 --- a/src/DefaultBtAnnounce.cc +++ b/src/DefaultBtAnnounce.cc @@ -68,7 +68,8 @@ DefaultBtAnnounce::DefaultBtAnnounce incomplete_(0), announceList_(bittorrent::getTorrentAttrs(downloadContext)->announceList), option_(option), - randomizer_(SimpleRandomizer::getInstance()) + randomizer_(SimpleRandomizer::getInstance()), + tcpPort_(0) {} DefaultBtAnnounce::~DefaultBtAnnounce() { @@ -166,9 +167,9 @@ std::string DefaultBtAnnounce::getAnnounceUrl() { uri += "&numwant="; uri += util::uitos(numWant); uri += "&no_peer_id=1"; - if(btRuntime_->getListenPort() > 0) { + if(tcpPort_) { uri += "&port="; - uri += util::uitos(btRuntime_->getListenPort()); + uri += util::uitos(tcpPort_); } std::string event = announceList_.getEventString(); if(!event.empty()) { |
