summaryrefslogtreecommitdiff
path: root/src/StreamFileAllocationEntry.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2017-03-02 22:54:11 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2017-03-02 22:54:11 +0900
commitbfc54d0b9a694e5d87efd8ed11b5393bc4b66f93 (patch)
treefde04123b650a5ac981b13506dfeeccf6036d659 /src/StreamFileAllocationEntry.cc
parent9eff8100ef28ccda14161a35628c51063cf66f66 (diff)
Save control file early
Diffstat (limited to 'src/StreamFileAllocationEntry.cc')
-rw-r--r--src/StreamFileAllocationEntry.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/StreamFileAllocationEntry.cc b/src/StreamFileAllocationEntry.cc
index fdb16f60..97011dd1 100644
--- a/src/StreamFileAllocationEntry.cc
+++ b/src/StreamFileAllocationEntry.cc
@@ -46,6 +46,7 @@
#include "FileEntry.h"
#include "PieceStorage.h"
#include "DiskAdaptor.h"
+#include "LogFactory.h"
namespace aria2 {
@@ -97,6 +98,15 @@ void StreamFileAllocationEntry::prepareForNextAction(
else {
rg->createNextCommandWithAdj(commands, e, 0);
}
+
+ if (!rg->allDownloadFinished()) {
+ try {
+ rg->saveControlFile();
+ }
+ catch (RecoverableException& e) {
+ A2_LOG_ERROR_EX(EX_EXCEPTION_CAUGHT, e);
+ }
+ }
}
} // namespace aria2