Prechádzať zdrojové kódy

2010-03-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

	Create CreateRequestCommand to the number of -s/-C when URIs are
	added by XML-RPC.
	* src/RequestGroup.cc
	* src/RequestGroup.h
	* src/XmlRpcMethodImpl.cc
Tatsuhiro Tsujikawa 15 rokov pred
rodič
commit
f3973e5a12
4 zmenil súbory, kde vykonal 38 pridanie a 0 odobranie
  1. 8 0
      ChangeLog
  2. 23 0
      src/RequestGroup.cc
  3. 2 0
      src/RequestGroup.h
  4. 5 0
      src/XmlRpcMethodImpl.cc

+ 8 - 0
ChangeLog

@@ -1,3 +1,11 @@
+2010-03-07  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
+
+	Create CreateRequestCommand to the number of -s/-C when URIs are
+	added by XML-RPC.
+	* src/RequestGroup.cc
+	* src/RequestGroup.h
+	* src/XmlRpcMethodImpl.cc
+
 2010-03-07  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
 
 	Added 'status' key to the response of getUri XML-RPC method.

+ 23 - 0
src/RequestGroup.cc

@@ -684,6 +684,29 @@ void RequestGroup::createNextCommandWithAdj(std::vector<Command*>& commands,
   }
 }
 
+void RequestGroup::createNextCommand(std::vector<Command*>& commands,
+                                     DownloadEngine* e)
+{
+  int numCommand;
+  if(getTotalLength() == 0) {
+    if(_numStreamConnection > 0) {
+      numCommand = 0;
+    } else {
+      numCommand = 1;
+    }
+  } else {
+    if(_numStreamConnection >= _numConcurrentCommand) {
+      numCommand = 0;
+    } else {
+      numCommand = std::min(_downloadContext->getNumPieces(),
+                            _numConcurrentCommand-_numStreamConnection);
+    }
+  }
+  if(numCommand > 0) {
+    createNextCommand(commands, e, numCommand);
+  }
+}
+
 void RequestGroup::createNextCommand(std::vector<Command*>& commands,
                                      DownloadEngine* e,
                                      unsigned int numCommand)

+ 2 - 0
src/RequestGroup.h

@@ -208,6 +208,8 @@ public:
   void createNextCommand(std::vector<Command*>& commands,
                          DownloadEngine* e, unsigned int numCommand);
   
+  void createNextCommand(std::vector<Command*>& commands, DownloadEngine* e);
+
   bool downloadFinished() const;
 
   bool allDownloadFinished() const;

+ 5 - 0
src/XmlRpcMethodImpl.cc

@@ -917,6 +917,11 @@ BDE ChangeUriXmlRpcMethod::process
       }
     }
   }
+  if(addcount) {
+    std::vector<Command*> commands;
+    group->createNextCommand(commands, e);
+    e->addCommand(commands);
+  }
   BDE res = BDE::list();
   res << delcount;
   res << addcount;