summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2015-05-12 23:08:10 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2015-05-12 23:08:10 +0900
commit38552050269e6e74e080765aa4ba844f65e028fd (patch)
treeca4aa10ac6279954776942c21d8da63979878f15
parent5100f96bfabac9af89801711f8e0c02c2ffdf28d (diff)
Exit with 32 status code if checksum verification failed
-rw-r--r--doc/manual-src/en/aria2c.rst6
-rw-r--r--src/ChecksumCheckIntegrityEntry.cc4
-rw-r--r--src/error_code.h3
3 files changed, 12 insertions, 1 deletions
diff --git a/doc/manual-src/en/aria2c.rst b/doc/manual-src/en/aria2c.rst
index e35aaf1b..3a03c83b 100644
--- a/doc/manual-src/en/aria2c.rst
+++ b/doc/manual-src/en/aria2c.rst
@@ -1767,6 +1767,12 @@ based on the last error encountered.
30
If aria2 could not parse JSON-RPC request.
+31
+ Reserved. Not used.
+
+32
+ If checksum validation failed.
+
.. note::
An error occurred in a finished download will not be reported
diff --git a/src/ChecksumCheckIntegrityEntry.cc b/src/ChecksumCheckIntegrityEntry.cc
index 12b5dfbe..f1c47e07 100644
--- a/src/ChecksumCheckIntegrityEntry.cc
+++ b/src/ChecksumCheckIntegrityEntry.cc
@@ -82,7 +82,11 @@ ChecksumCheckIntegrityEntry::onDownloadIncomplete
make_unique<StreamFileAllocationEntry>
(getRequestGroup(), popNextCommand()),
e);
+ return;
}
+
+ // If we don't redownload, set error code to indicate checksum error
+ getRequestGroup()->setLastErrorCode(error_code::CHECKSUM_ERROR);
}
} // namespace aria2
diff --git a/src/error_code.h b/src/error_code.h
index 34da3615..0d268c45 100644
--- a/src/error_code.h
+++ b/src/error_code.h
@@ -74,7 +74,8 @@ enum Value {
OPTION_ERROR = 28,
HTTP_SERVICE_UNAVAILABLE = 29,
JSON_PARSE_ERROR = 30,
- REMOVED = 31
+ REMOVED = 31,
+ CHECKSUM_ERROR = 32,
};
} // namespace error_code