浏览代码

2008-09-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	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
Tatsuhiro Tsujikawa 17 年之前
父节点
当前提交
d3453a8387
共有 4 个文件被更改,包括 17 次插入0 次删除
  1. 9 0
      ChangeLog
  2. 1 0
      src/AbstractCommand.cc
  3. 5 0
      src/RequestGroup.cc
  4. 2 0
      src/RequestGroup.h

+ 9 - 0
ChangeLog

@@ -1,3 +1,12 @@
+2008-09-03  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	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
+
 2008-09-02  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	Removed wrong comment.

+ 1 - 0
src/AbstractCommand.cc

@@ -213,6 +213,7 @@ void AbstractCommand::onAbort() {
   if(!_requestGroup->getPieceStorage().isNull()) {
     _requestGroup->getSegmentMan()->cancelSegment(cuid);
   }
+  _requestGroup->removeIdenticalURI(req->getUrl());
 }
 
 void AbstractCommand::disableReadCheckSocket() {

+ 5 - 0
src/RequestGroup.cc

@@ -960,6 +960,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,

+ 2 - 0
src/RequestGroup.h

@@ -342,6 +342,8 @@ public:
   
   void removeURIWhoseHostnameIs(const std::string& hostname);
 
+  void removeIdenticalURI(const std::string& uri);
+
   void reportDownloadFinished();
 
   const std::deque<std::string>& getAcceptFeatures() const;