Merge branch 'save-control-file-early'

pull/868/head
Tatsuhiro Tsujikawa 2017-03-05 19:58:02 +09:00
commit 7db393ec3d
2 changed files with 17 additions and 0 deletions

View File

@ -81,6 +81,13 @@ void BtFileAllocationEntry::prepareForNextAction(
std::end(fileEntries))) { std::end(fileEntries))) {
rg->createNextCommandWithAdj(commands, e, 0); rg->createNextCommandWithAdj(commands, e, 0);
} }
try {
rg->saveControlFile();
}
catch (RecoverableException& e) {
A2_LOG_ERROR_EX(EX_EXCEPTION_CAUGHT, e);
}
} }
else { else {
#ifdef __MINGW32__ #ifdef __MINGW32__

View File

@ -46,6 +46,7 @@
#include "FileEntry.h" #include "FileEntry.h"
#include "PieceStorage.h" #include "PieceStorage.h"
#include "DiskAdaptor.h" #include "DiskAdaptor.h"
#include "LogFactory.h"
namespace aria2 { namespace aria2 {
@ -97,6 +98,15 @@ void StreamFileAllocationEntry::prepareForNextAction(
else { else {
rg->createNextCommandWithAdj(commands, e, 0); rg->createNextCommandWithAdj(commands, e, 0);
} }
if (!rg->allDownloadFinished()) {
try {
rg->saveControlFile();
}
catch (RecoverableException& e) {
A2_LOG_ERROR_EX(EX_EXCEPTION_CAUGHT, e);
}
}
} }
} // namespace aria2 } // namespace aria2