Bläddra i källkod

2010-09-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

	Fixed the bug that aria2 reports error and exits with non-zero
	status when file is already downloaded.
	* src/FtpNegotiationCommand.cc
	* src/HttpResponseCommand.cc
	* src/RequestGroup.cc
Tatsuhiro Tsujikawa 15 år sedan
förälder
incheckning
32e1aa1b59
4 ändrade filer med 26 tillägg och 1 borttagningar
  1. 8 0
      ChangeLog
  2. 6 1
      src/FtpNegotiationCommand.cc
  3. 9 0
      src/HttpResponseCommand.cc
  4. 3 0
      src/RequestGroup.cc

+ 8 - 0
ChangeLog

@@ -1,3 +1,11 @@
+2010-09-08  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
+
+	Fixed the bug that aria2 reports error and exits with non-zero
+	status when file is already downloaded.
+	* src/FtpNegotiationCommand.cc
+	* src/HttpResponseCommand.cc
+	* src/RequestGroup.cc
+
 2010-09-08  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
 
 	Allow '@' in username and password embedded in URI. It should be

+ 6 - 1
src/FtpNegotiationCommand.cc

@@ -405,8 +405,10 @@ bool FtpNegotiationCommand::onFileSizeDetermined(uint64_t totalLength)
     if(getRequestGroup()->downloadFinishedByFileLength()) {
       getRequestGroup()->initPieceStorage();
       getPieceStorage()->markAllPiecesDone();
+      // TODO It would be good to issue ChecksumCheckIntegrity here
+      // instead of just pretending checksum verification is done.
+      getDownloadContext()->setChecksumVerified(true);
       sequence_ = SEQ_DOWNLOAD_ALREADY_COMPLETED;
-
       getLogger()->notice(MSG_DOWNLOAD_ALREADY_COMPLETED,
                           util::itos(getRequestGroup()->getGID()).c_str(),
                           getRequestGroup()->getFirstFilePath().c_str());
@@ -451,6 +453,9 @@ bool FtpNegotiationCommand::onFileSizeDetermined(uint64_t totalLength)
     if(!infoFile->exists() &&
        getRequestGroup()->downloadFinishedByFileLength()) {
       getPieceStorage()->markAllPiecesDone();
+      // TODO It would be good to issue ChecksumCheckIntegrity here
+      // instead of just pretending checksum verification is done.
+      getDownloadContext()->setChecksumVerified(true);
 
       sequence_ = SEQ_DOWNLOAD_ALREADY_COMPLETED;
       

+ 9 - 0
src/HttpResponseCommand.cc

@@ -131,6 +131,9 @@ bool HttpResponseCommand::executeInternal()
       getFileEntry()->setLength(totalLength);
       getRequestGroup()->initPieceStorage();
       getPieceStorage()->markAllPiecesDone();
+      // TODO It would be good to issue ChecksumCheckIntegrity here
+      // instead of just pretending checksum verification is done.
+      getDownloadContext()->setChecksumVerified(true);
       getLogger()->notice(MSG_DOWNLOAD_ALREADY_COMPLETED,
                           util::itos(getRequestGroup()->getGID()).c_str(),
                           getRequestGroup()->getFirstFilePath().c_str());
@@ -265,6 +268,9 @@ bool HttpResponseCommand::handleDefaultEncoding
                                    getOption().get()));
   if(!infoFile->exists() && getRequestGroup()->downloadFinishedByFileLength()) {
     getPieceStorage()->markAllPiecesDone();
+    // TODO It would be good to issue ChecksumCheckIntegrity here
+    // instead of just pretending checksum verification is done.
+    getDownloadContext()->setChecksumVerified(true);
     getLogger()->notice(MSG_DOWNLOAD_ALREADY_COMPLETED,
                         util::itos(getRequestGroup()->getGID()).c_str(),
                         getRequestGroup()->getFirstFilePath().c_str());
@@ -370,6 +376,9 @@ bool HttpResponseCommand::handleOtherEncoding
   if(getRequestGroup()->downloadFinishedByFileLength()) {
     getRequestGroup()->initPieceStorage();
     getPieceStorage()->markAllPiecesDone();
+    // TODO It would be good to issue ChecksumCheckIntegrity here
+    // instead of just pretending checksum verification is done.
+    getDownloadContext()->setChecksumVerified(true);
     getLogger()->notice(MSG_DOWNLOAD_ALREADY_COMPLETED,
                         util::itos(getRequestGroup()->getGID()).c_str(),
                         getRequestGroup()->getFirstFilePath().c_str());

+ 3 - 0
src/RequestGroup.cc

@@ -426,6 +426,9 @@ void RequestGroup::createInitialCommand
                                        option_.get()));
       if(!infoFile->exists() && downloadFinishedByFileLength()) {
         pieceStorage_->markAllPiecesDone();
+        // TODO It would be good to issue ChecksumCheckIntegrity here
+        // instead of just pretending checksum verification is done.
+        downloadContext_->setChecksumVerified(true);
         logger_->notice(MSG_DOWNLOAD_ALREADY_COMPLETED,
                         util::itos(gid_).c_str(),
                         downloadContext_->getBasePath().c_str());