diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-01-17 21:19:45 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-01-17 21:19:45 +0900 |
| commit | f2a63fa06a931333ac2e4a3a5d36a56418b4b6cd (patch) | |
| tree | 1a9114f36cdb32cfd5e0272b672f0c8d5b420cde /src/FileEntry.cc | |
| parent | 4824b09237e049ac7d912cdaa4a8a041eedd5dab (diff) | |
Added --retry-wait option.
This option was once existed in aria2 but erased on 2009-09-20. Now
it is resurrected once again. We choose 2 as default value, but there
is no good theory behind it. Now we retry HTTP download when remote
server returns 503 Service Unavailable if --retry-wait > 0. We also
added error code 29: HTTP_SERVICE_UNAVAILABLE.
Diffstat (limited to 'src/FileEntry.cc')
| -rw-r--r-- | src/FileEntry.cc | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/FileEntry.cc b/src/FileEntry.cc index 9fe560e9..262ae890 100644 --- a/src/FileEntry.cc +++ b/src/FileEntry.cc @@ -170,9 +170,23 @@ FileEntry::getRequest break; } } - } else { - req = requestPool_.front(); - requestPool_.pop_front(); + } else { + // Skip Request object if it is still + // sleeping(Request::getWakeTime() < global::wallclock). If all + // pooled objects are sleeping, return first one. Caller should + // inspect returned object's getWakeTime(). + std::deque<SharedHandle<Request> >::iterator i = requestPool_.begin(); + std::deque<SharedHandle<Request> >::iterator eoi = requestPool_.end(); + for(; i != eoi; ++i) { + if((*i)->getWakeTime() <= global::wallclock) { + break; + } + } + if(i == eoi) { + i = requestPool_.begin(); + } + req = *i; + requestPool_.erase(i); inFlightRequests_.push_back(req); A2_LOG_DEBUG(fmt("Picked up from pool: %s", req->getUri().c_str())); } |
