Skip to content

Commit

Permalink
Merge branch 'save-control-file-early'
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsuhiro-t committed Mar 5, 2017
2 parents 9eff810 + bfc54d0 commit 7db393e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/BtFileAllocationEntry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ void BtFileAllocationEntry::prepareForNextAction(
std::end(fileEntries))) {
rg->createNextCommandWithAdj(commands, e, 0);
}

try {
rg->saveControlFile();
}
catch (RecoverableException& e) {
A2_LOG_ERROR_EX(EX_EXCEPTION_CAUGHT, e);
}
}
else {
#ifdef __MINGW32__
Expand Down
10 changes: 10 additions & 0 deletions src/StreamFileAllocationEntry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "FileEntry.h"
#include "PieceStorage.h"
#include "DiskAdaptor.h"
#include "LogFactory.h"

namespace aria2 {

Expand Down Expand Up @@ -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

0 comments on commit 7db393e

Please sign in to comment.