Browse Source

2006-07-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	To fix the bug that .aria2 file is not saved if downloading is 
stopped
	by the errors:it results that aria2 can not resume downloading:
	
	* src/main.cc
	(normalDownload): Added the call to save().
	(main): Added the deletion of the elements in 'reserved'.

	To fix log:

	* src/PeerInteraction.cc
	(receiveHandshake): Fixed log.

	To improve the download performance just a little bit:

	* src/TorrentMan.cc
	(getPeer): Return nullPeer if connections is greater than
	MAX_PEER_UPDATE.
Tatsuhiro Tsujikawa 19 years ago
parent
commit
4745544046
4 changed files with 37 additions and 1 deletions
  1. 29 0
      ChangeLog
  2. 1 1
      src/PeerInteraction.cc
  3. 3 0
      src/TorrentMan.cc
  4. 4 0
      src/main.cc

+ 29 - 0
ChangeLog

@@ -1,3 +1,32 @@
+2006-07-07  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	To fix the bug that .aria2 file is not saved if downloading is stopped
+	by the errors:it results that aria2 can not resume downloading:
+	
+	* src/main.cc
+	(normalDownload): Added the call to save().
+	(main): Added the deletion of the elements in 'reserved'.
+
+	To fix log:
+
+	* src/PeerInteraction.cc
+	(receiveHandshake): Fixed log.
+
+	To improve the download performance just a little bit:
+
+	* src/TorrentMan.cc
+	(getPeer): Return nullPeer if connections is greater than
+	MAX_PEER_UPDATE.
+	
+2006-07-05  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	To improve download performance in BitTorrent:
+	
+	* src/TorrentMan.cc
+	(getPeer): Check the number of connections. Return nullPeer if
+	it is greater than MAX_PEER_UPDATE.
+	This code was originally here, but was removed in 0.5.1.
+
 2006-07-04  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
         To improve the conditional compilation:

+ 1 - 1
src/PeerInteraction.cc

@@ -310,7 +310,7 @@ HandshakeMessage* PeerInteraction::receiveHandshake(bool quickReply) {
   }
   if(handshakeMessage->isFastExtensionSupported()) {
     peer->setFastExtensionEnabled(true);
-    logger->info("CUID#%d - Fast extension enabled.");
+    logger->info("CUID#%d - Fast extension enabled.", cuid);
   }
   return handshakeMessage;
 }

+ 3 - 0
src/TorrentMan.cc

@@ -130,6 +130,9 @@ void TorrentMan::deleteOldErrorPeers() {
 }
 
 Peer* TorrentMan::getPeer() const {
+  if(connections > MAX_PEER_UPDATE) {
+    return Peer::nullPeer;
+  }
   for(Peers::const_iterator itr = peers.begin(); itr != peers.end(); itr++) {
     Peer* p = *itr;
     if(p->cuid == 0 && p->error < MAX_PEER_ERROR) {

+ 4 - 0
src/main.cc

@@ -323,6 +323,8 @@ bool normalDownload(const Requests& requests,
     downloadedFilename = e->segmentMan->getFilePath();
     success = true;
   } else {
+    e->segmentMan->save();
+    e->segmentMan->diskWriter->closeFile();
     printDownloadAbortMessage();
   }
   e->cleanQueue();
@@ -743,6 +745,7 @@ int main(int argc, char* argv[]) {
     normalDownload(requests, reserved, op, dir, ufilename, downloadedFilename);
 
     for_each(requests.begin(), requests.end(), Deleter());
+    for_each(reserved.begin(), reserved.end(), Deleter());
     requests.clear();
   }
 #ifdef ENABLE_METALINK
@@ -787,6 +790,7 @@ int main(int argc, char* argv[]) {
 				  downloadedFilename);
 
     for_each(requests.begin(), requests.end(), Deleter());
+    for_each(reserved.begin(), reserved.end(), Deleter());
     requests.clear();
 
     if(success) {