diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-10-31 21:53:24 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-10-31 21:53:24 +0900 |
| commit | e2e711fba8b888ba3ce8b9e89c10399dba6d134b (patch) | |
| tree | 7c1986483ffee116eb58df2634d0b114152845d2 /src/FileEntry.cc | |
| parent | 4532881eb6e910171c8b8d67ff81884913135b93 (diff) | |
Reuse in-flight and pooled URIs when a download is paused.
Diffstat (limited to 'src/FileEntry.cc')
| -rw-r--r-- | src/FileEntry.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/FileEntry.cc b/src/FileEntry.cc index 7d04e2dd..23721e7a 100644 --- a/src/FileEntry.cc +++ b/src/FileEntry.cc @@ -453,6 +453,25 @@ void FileEntry::releaseRuntimeResource() } namespace { +template<typename InputIterator> +void putBackUri +(std::deque<std::string>& uris, + InputIterator first, + InputIterator last) +{ + for(; first != last; ++first) { + uris.push_front((*first)->getUri()); + } +} +} // namespace + +void FileEntry::putBackRequest() +{ + putBackUri(uris_, requestPool_.begin(), requestPool_.end()); + putBackUri(uris_, inFlightRequests_.begin(), inFlightRequests_.end()); +} + +namespace { template<typename InputIterator, typename T> InputIterator findRequestByUri (InputIterator first, InputIterator last, const T& uri) |
