Forráskód Böngészése

Merge branch 'dont-save-control-file'

Tatsuhiro Tsujikawa 8 éve
szülő
commit
9f50d7353c
2 módosított fájl, 9 hozzáadás és 6 törlés
  1. 7 5
      src/BtFileAllocationEntry.cc
  2. 2 1
      src/StreamFileAllocationEntry.cc

+ 7 - 5
src/BtFileAllocationEntry.cc

@@ -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 {

+ 2 - 1
src/StreamFileAllocationEntry.cc

@@ -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();
     }