Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a wait in the retry for HTTP 404 error #1714

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/AbstractCommand.cc
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,10 @@ bool AbstractCommand::execute()
return true;
}

if (err.getErrorCode() == error_code::HTTP_SERVICE_UNAVAILABLE) {
if (err.getErrorCode() == error_code::HTTP_SERVICE_UNAVAILABLE ||
err.getErrorCode() == error_code::RESOURCE_NOT_FOUND) {
A2_LOG_DEBUG(fmt(MSG_RETRY_WAITING, getCuid(), getOption()->getAsInt(PREF_RETRY_WAIT),
req_->getUri().c_str()));
Timer wakeTime(global::wallclock());
wakeTime.advance(
std::chrono::seconds(getOption()->getAsInt(PREF_RETRY_WAIT)));
Expand Down
1 change: 1 addition & 0 deletions src/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#define MSG_SENDING_REQUEST "CUID#%" PRId64 " - Requesting:\n%s"
#define MSG_RECEIVE_RESPONSE "CUID#%" PRId64 " - Response received:\n%s"
#define MSG_DOWNLOAD_ABORTED "CUID#%" PRId64 " - Download aborted. URI=%s"
#define MSG_RETRY_WAITING "CUID#%" PRId64 " - Waiting (%d sec) for retry of the download. URI=%s"
#define MSG_RESTARTING_DOWNLOAD "CUID#%" PRId64 " - Restarting the download. URI=%s"
#define MSG_TORRENT_DOWNLOAD_ABORTED "CUID#%" PRId64 " - Download aborted."
#define MSG_MAX_TRY \
Expand Down