From bfc54d0b9a694e5d87efd8ed11b5393bc4b66f93 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 2 Mar 2017 22:54:11 +0900 Subject: Save control file early --- src/StreamFileAllocationEntry.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/StreamFileAllocationEntry.cc') 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 -- cgit