diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-07-10 22:42:49 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-07-10 22:42:49 +0900 |
| commit | babdcb2c7d249b19ad38a07158e829f52a08e75a (patch) | |
| tree | 7207be5d5f5762754fd601fbafe5c43ea479a0ec /src/HaveEraseCommand.cc | |
| parent | f2aa7564b09f6c80d9975533401396f11a0e8439 (diff) | |
Change have entry indexing method
Now use increasing sequence of integer rather than timer value.
Diffstat (limited to 'src/HaveEraseCommand.cc')
| -rw-r--r-- | src/HaveEraseCommand.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/HaveEraseCommand.cc b/src/HaveEraseCommand.cc index 30bacfc4..51ef9a53 100644 --- a/src/HaveEraseCommand.cc +++ b/src/HaveEraseCommand.cc @@ -37,6 +37,7 @@ #include "RequestGroupMan.h" #include "PieceStorage.h" #include "RequestGroup.h" +#include "wallclock.h" namespace aria2 { @@ -58,13 +59,19 @@ void HaveEraseCommand::preProcess() void HaveEraseCommand::process() { - const RequestGroupList& groups = + // we are making a copy of current wallclock. + auto expiry = global::wallclock(); + expiry.advance(5_s); + + const auto& groups = getDownloadEngine()->getRequestGroupMan()->getRequestGroups(); for (auto& group : groups) { const auto& ps = group->getPieceStorage(); - if (ps) { - ps->removeAdvertisedPiece(5_s); + if (!ps) { + continue; } + + ps->removeAdvertisedPiece(expiry); } } |
