diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-01-19 11:24:57 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-01-19 11:24:57 +0900 |
| commit | 8b93b12488d12820470e14f0ebbb656728f7df83 (patch) | |
| tree | 0d1f76f36d1606ea94b623e222430b7d7fe862e7 /src/TrackerWatcherCommand.cc | |
| parent | 7b2e797fdfa27794b0f4a96bba0c42b5e67a6050 (diff) | |
Reduce delay in tracker request
We eliminated 1 second delay between completion of name resolution for
tracker request and time when it is actually issued. We also elimited
1 second delay after last torrent download exists and it is told to
DHTInteractionCommand.
Diffstat (limited to 'src/TrackerWatcherCommand.cc')
| -rw-r--r-- | src/TrackerWatcherCommand.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/TrackerWatcherCommand.cc b/src/TrackerWatcherCommand.cc index 30c27edd..2e6f4f31 100644 --- a/src/TrackerWatcherCommand.cc +++ b/src/TrackerWatcherCommand.cc @@ -229,6 +229,7 @@ bool TrackerWatcherCommand::execute() trackerRequest_ = createAnnounce(e_); if (trackerRequest_) { trackerRequest_->issue(e_); + A2_LOG_DEBUG("tracker request created"); } } else if (trackerRequest_->stopped()) { @@ -259,6 +260,12 @@ bool TrackerWatcherCommand::execute() } } } + + if (!trackerRequest_ && btAnnounce_->noMoreAnnounce()) { + A2_LOG_DEBUG("no more announce"); + return true; + } + e_->addCommand(std::unique_ptr<Command>(this)); return false; } @@ -325,8 +332,10 @@ std::unique_ptr<AnnRequest> TrackerWatcherCommand::createUDPAnnRequest(const std::string& host, uint16_t port, uint16_t localPort) { - return make_unique<UDPAnnRequest>( - btAnnounce_->createUDPTrackerRequest(host, port, localPort)); + auto req = btAnnounce_->createUDPTrackerRequest(host, port, localPort); + req->user_data = this; + + return make_unique<UDPAnnRequest>(std::move(req)); } namespace { |
