summaryrefslogtreecommitdiff
path: root/src/FileEntry.h
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-06-29 15:18:21 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-06-29 15:18:21 +0000
commitc4d79d7160569bef82c4a67b267d78289b91e449 (patch)
tree23d390e759271fa4a55b677d09ff0e23b0111a7d /src/FileEntry.h
parente82f870fdc3c1a7fc2c0b66a9f623a5386ece3d6 (diff)
2009-06-30 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten PeerStat handling. In the previous implementation, faster command tries to find slower command. In this new implementation, slower command tries to find faster command. PeerStat is now created in each HTTP/FTP request to get download rate correctly. If the download range is small, the download rate tends to small and this will occur at the later stage of download. * src/AbstractCommand.cc * src/DownloadCommand.cc * src/FileEntry.cc * src/FileEntry.h * src/Request.cc * src/Request.h * src/RequestGroup.h * src/RequestGroupMan.cc * src/SegmentMan.cc * src/SegmentMan.h * test/SegmentManTest.cc
Diffstat (limited to 'src/FileEntry.h')
-rw-r--r--src/FileEntry.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/FileEntry.h b/src/FileEntry.h
index 3d9106e9..93137fb7 100644
--- a/src/FileEntry.h
+++ b/src/FileEntry.h
@@ -70,6 +70,8 @@ private:
std::deque<URIResult> _uriResults;
Logger* _logger;
+
+ void storePool(const SharedHandle<Request>& request);
public:
FileEntry();
@@ -158,6 +160,11 @@ public:
// and return the Request object.
SharedHandle<Request> getRequest(const SharedHandle<URISelector>& selector);
+ // Finds pooled Request object which is faster than passed one,
+ // comparing their PeerStat objects. If such Request is found, it is
+ // removed from the pool and returned.
+ SharedHandle<Request> findFasterRequest(const SharedHandle<Request>& base);
+
void poolRequest(const SharedHandle<Request>& request);
bool removeRequest(const SharedHandle<Request>& request);
@@ -167,6 +174,11 @@ public:
return _inFlightRequests.size();
}
+ size_t countPooledRequest() const
+ {
+ return _requestPool.size();
+ }
+
bool operator<(const FileEntry& fileEntry) const;
bool exists() const;