Jelajahi Sumber

2007-05-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	* Added the simultaneous download feature.
	* src/main.cc: Print "Exception caught: " when exception is 
caught.
Tatsuhiro Tsujikawa 18 tahun lalu
induk
melakukan
f3995b1f7e
6 mengubah file dengan 10 tambahan dan 8 penghapusan
  1. 2 1
      ChangeLog
  2. 1 0
      TODO
  3. 1 3
      src/RequestGroup.cc
  4. 4 3
      src/TorrentRequestInfo.cc
  5. 1 1
      src/main.cc
  6. 1 0
      src/message.h

+ 2 - 1
ChangeLog

@@ -1,7 +1,8 @@
 2007-05-20  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	* Added the simultaneous download feature.
-
+	* src/main.cc: Print "Exception caught: " when exception is caught.
+	
 2007-04-06  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	* src/PeerAbstractCommand.cc

+ 1 - 0
TODO

@@ -37,3 +37,4 @@
 * Do not use ufilename in multi-simultaneous download mode.
 * Merge umask patch.
 https://sourceforge.net/tracker/index.php?func=detail&aid=1718641&group_id=159897&atid=813673
+* Use CUIDCounter to generate CUID.

+ 1 - 3
src/RequestGroup.cc

@@ -113,9 +113,7 @@ void RequestGroup::shouldCancelDownloadForSafety()
 		   _segmentMan->getFilePath().c_str(),
 		   _segmentMan->getSegmentFilePath().c_str());
     
-    throw new FatalException(EX_FILE_ALREADY_EXISTS,
-			     _segmentMan->getFilePath().c_str(),
-			     _segmentMan->getSegmentFilePath().c_str());
+    throw new FatalException(EX_DOWNLOAD_ABORTED);
   }
 }
 

+ 4 - 3
src/TorrentRequestInfo.cc

@@ -81,9 +81,10 @@ RequestInfos TorrentRequestInfo::execute() {
   } else {
     if(PIECE_STORAGE(btContext)->getDiskAdaptor()->fileExists()) {
       if(op->get(PREF_ALLOW_OVERWRITE) != V_TRUE) {
-	throw new FatalException(EX_FILE_ALREADY_EXISTS,
-				 PIECE_STORAGE(btContext)->getDiskAdaptor()->getFilePath().c_str(),
-				 BT_PROGRESS_INFO_FILE(btContext)->getFilename().c_str());
+	logger->notice(MSG_FILE_ALREADY_EXISTS,
+		       PIECE_STORAGE(btContext)->getDiskAdaptor()->getFilePath().c_str(),
+		       BT_PROGRESS_INFO_FILE(btContext)->getFilename().c_str());
+	throw new FatalException(EX_DOWNLOAD_ABORTED);
       } else {
 	PIECE_STORAGE(btContext)->getDiskAdaptor()->openExistingFile();
 #ifdef ENABLE_MESSAGE_DIGEST

+ 1 - 1
src/main.cc

@@ -741,7 +741,7 @@ int main(int argc, char* argv[]) {
       */
     }
   } catch(Exception* ex) {
-    cerr << ex->getMsg() << endl;
+    cerr << "Exception caught:\n" << ex->getMsg() << endl;
     delete ex;
     exit(EXIT_FAILURE);
   }

+ 1 - 0
src/message.h

@@ -118,4 +118,5 @@
 #define EX_INVALID_PAYLOAD_SIZE _("Invalid payload size for %s, size=%d. It should be %d.")
 #define EX_INVALID_BT_MESSAGE_ID _("Invalid ID=%d for %s. It should be %d.")
 #define EX_INVALID_CHUNK_CHECKSUM _("Chunk checksum validation failed. checksumIndex=%d, offset=%lld, expectedHash=%s, actualHash=%s")
+#define EX_DOWNLOAD_ABORTED _("Download aborted.")
 #endif // _D_MESSAGE_H_