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

2007-10-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	Added --no-file-allocation-limit command-line option.
	Because this option's goal is to speed up simultaneous 
multi-file
	download for http/ftp, I decided to make BitTorrent download 
ingore
	this option.
	* src/main.cc
	* src/OptionHandlerFactory.cc
	* src/RequestGroup.cc
	* src/prefs.h
	* doc/aria2c.1.txt
	* doc/aria2c.1
Tatsuhiro Tsujikawa 18 éve
szülő
commit
c6df43611f
7 módosított fájl, 44 hozzáadás és 5 törlés
  1. 13 0
      ChangeLog
  2. 8 3
      doc/aria2c.1
  3. 7 0
      doc/aria2c.1.txt
  4. 2 1
      src/OptionHandlerFactory.cc
  5. 2 1
      src/RequestGroup.cc
  6. 10 0
      src/main.cc
  7. 2 0
      src/prefs.h

+ 13 - 0
ChangeLog

@@ -1,3 +1,16 @@
+2007-10-27  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	Added --no-file-allocation-limit command-line option.
+	Because this option's goal is to speed up simultaneous multi-file
+	download for http/ftp, I decided to make BitTorrent download ingore
+	this option.
+	* src/main.cc
+	* src/OptionHandlerFactory.cc
+	* src/RequestGroup.cc
+	* src/prefs.h
+	* doc/aria2c.1.txt
+	* doc/aria2c.1
+
 2007-10-26  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	Now prealloc is the default value for --file-allocation option.

+ 8 - 3
doc/aria2c.1

@@ -1,11 +1,11 @@
 .\"     Title: aria2c
 .\"    Author: 
 .\" Generator: DocBook XSL Stylesheets v1.73.1 <http://docbook.sf.net/>
-.\"      Date: 09/10/2007
+.\"      Date: 10/27/2007
 .\"    Manual: 
 .\"    Source: 
 .\"
-.TH "ARIA2C" "1" "09/10/2007" "" ""
+.TH "ARIA2C" "1" "10/27/2007" "" ""
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
@@ -193,7 +193,12 @@ or
 \fInone\fR
 doesn\'t pre\-allocate file space\.
 \fIprealloc\fR
-pre\-allocates file space before download begins\. This may take some time depending on the size of the file\. Default: none
+pre\-allocates file space before download begins\. This may take some time depending on the size of the file\. Default: prealloc
+.RE
+.PP
+\-\-no\-file\-allocation\-limit=SIZE
+.RS 4
+No file allocation is made for files whose size is smaller than SIZE\. You can append K or M(1K = 1024, 1M = 1024K)\. BitTorrent downloads ignore this option\. Default: 5M
 .RE
 .PP
 \-\-allow\-overwrite=true|false

+ 7 - 0
doc/aria2c.1.txt

@@ -130,6 +130,13 @@ OPTIONS
                               depending on the size of the file.
                               Default: prealloc
 
+ --no-file-allocation-limit=SIZE::
+ No file allocation is made for files whose
+                              size is smaller than SIZE.
+                              You can append K or M(1K = 1024, 1M = 1024K).
+                              BitTorrent downloads ignore this option.
+                              Default: 5M
+
  --allow-overwrite=true|false::
   If false, aria2 doesn't download a file which
                               already exists but the corresponding .aria2 file

+ 2 - 1
src/OptionHandlerFactory.cc

@@ -96,7 +96,8 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
   handlers.push_back(new DefaultOptionHandler(PREF_PEER_ID_PREFIX));
   handlers.push_back(new BooleanOptionHandler(PREF_FORCE_SEQUENTIAL));  
   handlers.push_back(new BooleanOptionHandler(PREF_AUTO_FILE_RENAMING));  
-  handlers.push_back(new BooleanOptionHandler(PREF_PARAMETERIZED_URI));  
+  handlers.push_back(new BooleanOptionHandler(PREF_PARAMETERIZED_URI));
+  handlers.push_back(new UnitNumberOptionHandler(PREF_NO_FILE_ALLOCATION_LIMIT, 0));
 
   return handlers;
 }

+ 2 - 1
src/RequestGroup.cc

@@ -149,7 +149,8 @@ void RequestGroup::initAndOpenFile()
 bool RequestGroup::needsFileAllocation() const
 {
   return _option->get(PREF_FILE_ALLOCATION) == V_PREALLOC
-    && File(_segmentMan->getFilePath()).size() < _segmentMan->totalSize;
+    && File(_segmentMan->getFilePath()).size() < _segmentMan->totalSize
+    && _option->getAsLLInt(PREF_NO_FILE_ALLOCATION_LIMIT) < _segmentMan->totalSize;
 }
   
 bool RequestGroup::fileExists() const

+ 10 - 0
src/main.cc

@@ -192,6 +192,11 @@ void showUsage() {
 	    "                              before download begins. This may take some time\n"
 	    "                              depending on the size of the file.\n"
 	    "                              Default: prealloc") << endl;
+  cout << _(" --no-file-allocation-limit=SIZE No file allocation is made for files whose\n"
+	    "                              size is smaller than SIZE.\n"
+	    "                              You can append K or M(1K = 1024, 1M = 1024K).\n"
+	    "                              BitTorrent downloads ignore this option.\n"
+	    "                              Default: 5M") << endl;
   cout << _(" --allow-overwrite=true|false If false, aria2 doesn't download a file which\n"
   		"                              already exists but the corresponding .aria2 file\n"
   		"                              doesn't exist.\n"
@@ -443,6 +448,7 @@ int main(int argc, char* argv[]) {
   op->put(PREF_STARTUP_IDLE_TIME, "10");
   op->put(PREF_TRACKER_MAX_TRIES, "10");
   op->put(PREF_FILE_ALLOCATION, V_PREALLOC);
+  op->put(PREF_NO_FILE_ALLOCATION_LIMIT, "5242880"); // 5MiB
   op->put(PREF_ALLOW_OVERWRITE, V_FALSE);
   op->put(PREF_REALTIME_CHUNK_CHECKSUM, V_TRUE);
   op->put(PREF_CHECK_INTEGRITY, V_FALSE);
@@ -500,6 +506,7 @@ int main(int argc, char* argv[]) {
       { "force-sequential", optional_argument, 0, 'Z' },
       { "auto-file-renaming", optional_argument, &lopt, 206 },
       { "parameterized-uri", optional_argument, 0, 'P' },
+      { "no-file-allocation-limit", required_argument, &lopt, 207 },
 #if defined ENABLE_BITTORRENT || ENABLE_METALINK
       { "show-files", no_argument, NULL, 'S' },
       { "select-file", required_argument, &lopt, 21 },
@@ -641,6 +648,9 @@ int main(int argc, char* argv[]) {
       case 206:
 	cmdstream << PREF_AUTO_FILE_RENAMING << "=" << toBoolArg(optarg) << "\n";
 	break;
+      case 207:
+	cmdstream << PREF_NO_FILE_ALLOCATION_LIMIT << "=" << optarg << "\n";
+	break;
       }
       break;
     }

+ 2 - 0
src/prefs.h

@@ -87,6 +87,8 @@
 // value: prealloc | none
 #define PREF_FILE_ALLOCATION "file-allocation"
 #  define V_PREALLOC "prealloc"
+#// value: 1*digit
+#define PREF_NO_FILE_ALLOCATION_LIMIT "no-file-allocation-limit"
 // value: true | false
 #define PREF_ALLOW_OVERWRITE "allow-overwrite"
 // value: true | false