diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2015-06-08 02:03:31 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2015-06-09 02:05:34 +0900 |
| commit | 99cd73c0926f0c07d27777fde2f15816e8040030 (patch) | |
| tree | 7c6a077b0590c49029c76686afb9c2ab1d00bb6d /src/FileEntry.cc | |
| parent | 2874f6ab095a30a4d297cdc85fa3730bec41b1c2 (diff) | |
Replace timer facility with chrono lib
Diffstat (limited to 'src/FileEntry.cc')
| -rw-r--r-- | src/FileEntry.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/FileEntry.cc b/src/FileEntry.cc index bcf75f26..2ab1291c 100644 --- a/src/FileEntry.cc +++ b/src/FileEntry.cc @@ -72,7 +72,7 @@ FileEntry::FileEntry(std::string path, int64_t length, int64_t offset, offset_(offset), uris_(uris.begin(), uris.end()), path_(std::move(path)), - lastFasterReplace_(0), + lastFasterReplace_(Timer::zero()), maxConnectionPerServer_(1), requested_(true), uniqueProtocol_(false) @@ -213,10 +213,13 @@ FileEntry::getRequest return req; } +namespace { +constexpr auto startupIdleTime = std::chrono::seconds(10); +} // namespace + std::shared_ptr<Request> FileEntry::findFasterRequest(const std::shared_ptr<Request>& base) { - const int startupIdleTime = 10; if(requestPool_.empty() || lastFasterReplace_.difference(global::wallclock()) < startupIdleTime) { return nullptr; @@ -248,7 +251,6 @@ FileEntry::findFasterRequest const std::vector<std::pair<size_t, std::string> >& usedHosts, const std::shared_ptr<ServerStatMan>& serverStatMan) { - const int startupIdleTime = 10; const int SPEED_THRESHOLD = 20*1024; if(lastFasterReplace_.difference(global::wallclock()) < startupIdleTime) { return nullptr; |
