summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-07-05 09:10:08 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-07-05 09:10:08 +0000
commite40d6b7c0fdfc2518fcf0d79a4c45f8cb769db94 (patch)
tree503311fc08ad1b2afeba8bf83178d41fc6e578b6
parentf0edf98651f7f437bbd9b901907c9a3259687d10 (diff)
2009-07-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Release pooled and in-flight Request objectsand URIResult objects in FileEntry after download completed. * src/DownloadContext.cc * src/DownloadContext.h * src/FileEntry.cc * src/FileEntry.h * src/RequestGroup.cc
-rw-r--r--ChangeLog10
-rw-r--r--src/DownloadContext.cc8
-rw-r--r--src/DownloadContext.h2
-rw-r--r--src/FileEntry.cc7
-rw-r--r--src/FileEntry.h2
-rw-r--r--src/RequestGroup.cc3
6 files changed, 30 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 901e05f9..1363ed71 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2009-07-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
+ Release pooled and in-flight Request objectsand URIResult objects
+ in FileEntry after download completed.
+ * src/DownloadContext.cc
+ * src/DownloadContext.h
+ * src/FileEntry.cc
+ * src/FileEntry.h
+ * src/RequestGroup.cc
+
+2009-07-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
+
Set manual and source attribute in aria2c.1.txt
* doc/aria2c.1.txt
diff --git a/src/DownloadContext.cc b/src/DownloadContext.cc
index f002eb3d..b450d8fd 100644
--- a/src/DownloadContext.cc
+++ b/src/DownloadContext.cc
@@ -165,4 +165,12 @@ bool DownloadContext::hasAttribute(const std::string& key) const
}
}
+void DownloadContext::releaseRuntimeResource()
+{
+ for(std::vector<SharedHandle<FileEntry> >::const_iterator i =
+ _fileEntries.begin(); i != _fileEntries.end(); ++i) {
+ (*i)->releaseRuntimeResource();
+ }
+}
+
} // namespace aria2
diff --git a/src/DownloadContext.h b/src/DownloadContext.h
index 479efab5..44af2c4b 100644
--- a/src/DownloadContext.h
+++ b/src/DownloadContext.h
@@ -235,6 +235,8 @@ public:
// Returns FileEntry at given offset. SharedHandle<FileEntry>() is
// returned if no such FileEntry is found.
SharedHandle<FileEntry> findFileEntryByOffset(off_t offset) const;
+
+ void releaseRuntimeResource();
};
} // namespace aria2
diff --git a/src/FileEntry.cc b/src/FileEntry.cc
index 25d195e2..5e1ffb4b 100644
--- a/src/FileEntry.cc
+++ b/src/FileEntry.cc
@@ -313,4 +313,11 @@ void FileEntry::reuseUri(size_t num)
}
}
+void FileEntry::releaseRuntimeResource()
+{
+ _requestPool.clear();
+ _inFlightRequests.clear();
+ _uriResults.clear();
+}
+
} // namespace aria2
diff --git a/src/FileEntry.h b/src/FileEntry.h
index 74716141..6e894f6d 100644
--- a/src/FileEntry.h
+++ b/src/FileEntry.h
@@ -231,6 +231,8 @@ public:
// reuse, those URIs are used more than once so that num URIs total
// are available to reuse.
void reuseUri(size_t num);
+
+ void releaseRuntimeResource();
};
typedef SharedHandle<FileEntry> FileEntryHandle;
diff --git a/src/RequestGroup.cc b/src/RequestGroup.cc
index cbf24b68..2bbf91aa 100644
--- a/src/RequestGroup.cc
+++ b/src/RequestGroup.cc
@@ -800,6 +800,7 @@ void RequestGroup::releaseRuntimeResource(DownloadEngine* e)
if(!_pieceStorage.isNull()) {
_pieceStorage->removeAdvertisedPiece(0);
}
+ _downloadContext->releaseRuntimeResource();
}
void RequestGroup::preDownloadProcessing()
@@ -945,8 +946,6 @@ DownloadResultHandle RequestGroup::createDownloadResult() const
sessionDownloadLength +=
_segmentMan->calculateSessionDownloadLength();
}
-
- // TODO1.5 Purge unnecessary data in FileEntry here.
return
SharedHandle<DownloadResult>
(new DownloadResult(_gid,