summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-09-03 12:29:04 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-09-03 12:29:04 +0000
commit18581f4a73617b188fe2b93f0fe8ffc4fe4c685b (patch)
treef020e8cf4c55146c3956fea0597b7e111e99493f /src
parent7ff9ab377b5ce286c1feb0436452540b959a49c1 (diff)
2008-09-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Merged from trunk -r693:695 DEFAULT_ANNOUNCE_INTERVAL: unsigned int -> time_t * src/BtAnnounce.h If an error occurred with a URI, remove identical URI from remaining URI list because it is likely that same error occurred in the end and it is waste of time. * src/AbstractCommand.cc * src/RequestGroup.cc * src/RequestGroup.h
Diffstat (limited to 'src')
-rw-r--r--src/AbstractCommand.cc1
-rw-r--r--src/BtAnnounce.h2
-rw-r--r--src/RequestGroup.cc5
-rw-r--r--src/RequestGroup.h2
4 files changed, 9 insertions, 1 deletions
diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc
index eb2f2aee..001b3556 100644
--- a/src/AbstractCommand.cc
+++ b/src/AbstractCommand.cc
@@ -201,6 +201,7 @@ void AbstractCommand::onAbort() {
if(!_requestGroup->getPieceStorage().isNull()) {
_requestGroup->getSegmentMan()->cancelSegment(cuid);
}
+ _requestGroup->removeIdenticalURI(req->getUrl());
}
void AbstractCommand::disableReadCheckSocket() {
diff --git a/src/BtAnnounce.h b/src/BtAnnounce.h
index 1eb6978f..32759758 100644
--- a/src/BtAnnounce.h
+++ b/src/BtAnnounce.h
@@ -123,7 +123,7 @@ public:
static const std::string PEERS;
- static const unsigned int DEFAULT_ANNOUNCE_INTERVAL = 120;
+ static const time_t DEFAULT_ANNOUNCE_INTERVAL = 120;
};
typedef SharedHandle<BtAnnounce> BtAnnounceHandle;
diff --git a/src/RequestGroup.cc b/src/RequestGroup.cc
index 7b5d49ca..22d22cde 100644
--- a/src/RequestGroup.cc
+++ b/src/RequestGroup.cc
@@ -957,6 +957,11 @@ void RequestGroup::removeURIWhoseHostnameIs(const std::string& hostname)
_uris = newURIs;
}
+void RequestGroup::removeIdenticalURI(const std::string& uri)
+{
+ _uris.erase(std::remove(_uris.begin(), _uris.end(), uri), _uris.end());
+}
+
void RequestGroup::reportDownloadFinished()
{
_logger->notice(MSG_FILE_DOWNLOAD_COMPLETED,
diff --git a/src/RequestGroup.h b/src/RequestGroup.h
index 6eeaf741..94f2d853 100644
--- a/src/RequestGroup.h
+++ b/src/RequestGroup.h
@@ -339,6 +339,8 @@ public:
void removeURIWhoseHostnameIs(const std::string& hostname);
+ void removeIdenticalURI(const std::string& uri);
+
void reportDownloadFinished();
const std::deque<std::string>& getAcceptFeatures() const;