소스 검색

Always save control file if --force-save is given

Tatsuhiro Tsujikawa 12 년 전
부모
커밋
de55569de5
3개의 변경된 파일12개의 추가작업 그리고 9개의 파일을 삭제
  1. 3 2
      doc/manual-src/en/aria2c.rst
  2. 5 5
      src/RequestGroupMan.cc
  3. 4 2
      src/usage_text.h

+ 3 - 2
doc/manual-src/en/aria2c.rst

@@ -1144,8 +1144,9 @@ Advanced Options
 .. option:: --force-save[=true|false]
 
   Save download with :option:`--save-session <--save-session>` option
-  even if the download is completed or removed. This may be useful to
-  save BitTorrent seeding which is recognized as completed state.
+  even if the download is completed or removed. This option also saves
+  control file in that situations. This may be useful to save
+  BitTorrent seeding which is recognized as completed state.
   Default: ``false``
 
 .. option:: --gid=<GID>

+ 5 - 5
src/RequestGroupMan.cc

@@ -334,7 +334,8 @@ public:
            !group->getDownloadContext()->isChecksumVerificationNeeded()) {
           group->applyLastModifiedTimeToLocalFiles();
           group->reportDownloadFinished();
-          if(group->allDownloadFinished()) {
+          if(group->allDownloadFinished() &&
+             !group->getOption()->getAsBool(PREF_FORCE_SAVE)) {
             group->removeControlFile();
             saveSignature(group);
           } else {
@@ -517,11 +518,10 @@ void RequestGroupMan::fillRequestGroupFromReserver(DownloadEngine* e)
 
 void RequestGroupMan::save()
 {
-  for(RequestGroupList::iterator itr = requestGroups_.begin(),
-        eoi = requestGroups_.end(); itr != eoi; ++itr) {
-    const std::shared_ptr<RequestGroup>& rg = *itr;
+  for(auto& rg : requestGroups_) {
     if(rg->allDownloadFinished() &&
-       !rg->getDownloadContext()->isChecksumVerificationNeeded()) {
+       !rg->getDownloadContext()->isChecksumVerificationNeeded() &&
+       !rg->getOption()->getAsBool(PREF_FORCE_SAVE)) {
       rg->removeControlFile();
     } else {
       try {

+ 4 - 2
src/usage_text.h

@@ -921,8 +921,10 @@
 #define TEXT_FORCE_SAVE                         \
   _(" --force-save[=true|false]    Save download with --save-session option even\n" \
     "                              if the download is completed or removed. This\n" \
-    "                              may be useful to save BitTorrent seeding which\n" \
-    "                              is recognized as completed state.")
+    "                              option also saves control file in that\n" \
+    "                              situations. This may be useful to save\n" \
+    "                              BitTorrent seeding which is recognized as\n" \
+    "                              completed state.")
 #define TEXT_DISK_CACHE                         \
   _(" --disk-cache=SIZE            Enable disk cache. If SIZE is 0, the disk cache\n" \
     "                              is disabled. This feature caches the downloaded\n" \