Jelajahi Sumber

2008-03-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	Changed inactive connection timeout to 120.
	To accept more mulually interested peers, disconnect peer when 
there
	is no interest between us after certain time passed.
	* src/DefaultBtInteractive.cc (checkActiveInteraction)
Tatsuhiro Tsujikawa 17 tahun lalu
induk
melakukan
74b82c44e8
2 mengubah file dengan 25 tambahan dan 3 penghapusan
  1. 7 0
      ChangeLog
  2. 18 3
      src/DefaultBtInteractive.cc

+ 7 - 0
ChangeLog

@@ -1,3 +1,10 @@
+2008-03-05  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	Changed inactive connection timeout to 120.
+	To accept more mulually interested peers, disconnect peer when there
+	is no interest between us after certain time passed.
+	* src/DefaultBtInteractive.cc (checkActiveInteraction)
+
 2008-03-05  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	Fixed the bug that aria2 only uses first dns server in resolv.conf

+ 18 - 3
src/DefaultBtInteractive.cc

@@ -361,9 +361,24 @@ void DefaultBtInteractive::detectMessageFlooding() {
 
 void DefaultBtInteractive::checkActiveInteraction()
 {
-  int32_t interval = 5*60;
-  if(inactiveCheckPoint.elapsed(interval)) {
-    throw new DlAbortEx(EX_DROP_INACTIVE_CONNECTION, interval);
+  // To allow aria2 to accept mutially interested peer, disconnect unintersted
+  // peer.
+  {
+    time_t interval = 30;
+    if(!peer->amInterested() && !peer->peerInterested() &&
+       inactiveCheckPoint.elapsed(interval)) {
+      // TODO change the message
+      throw new DlAbortEx("Disconnect peer because we are not interested each other after %u second(s).", interval);
+    }
+  }
+  // Since the peers which are *just* connected and do nothing to improve
+  // mutual download progress are completely waste of resources, those peers
+  // are disconnected in a certain time period.
+  {
+    time_t interval = 2*60;
+    if(inactiveCheckPoint.elapsed(interval)) {
+      throw new DlAbortEx(EX_DROP_INACTIVE_CONNECTION, interval);
+    }
   }
 }