Skip to content

Commit

Permalink
Fix regression in bfc54d0
Browse files Browse the repository at this point in the history
Don't save control file if --auto-save-interval is 0.
  • Loading branch information
tatsuhiro-t committed May 20, 2017
1 parent 8785342 commit 3cfea3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/BtFileAllocationEntry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ void BtFileAllocationEntry::prepareForNextAction(
rg->createNextCommandWithAdj(commands, e, 0);
}

try {
rg->saveControlFile();
}
catch (RecoverableException& e) {
A2_LOG_ERROR_EX(EX_EXCEPTION_CAUGHT, e);
if (option->getAsInt(PREF_AUTO_SAVE_INTERVAL) != 0) {
try {
rg->saveControlFile();
}
catch (RecoverableException& e) {
A2_LOG_ERROR_EX(EX_EXCEPTION_CAUGHT, e);
}
}
}
else {
Expand Down
3 changes: 2 additions & 1 deletion src/StreamFileAllocationEntry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ void StreamFileAllocationEntry::prepareForNextAction(
rg->createNextCommandWithAdj(commands, e, 0);
}

if (!rg->allDownloadFinished()) {
if (option->getAsInt(PREF_AUTO_SAVE_INTERVAL) != 0 &&
!rg->allDownloadFinished()) {
try {
rg->saveControlFile();
}
Expand Down

0 comments on commit 3cfea3c

Please sign in to comment.