summaryrefslogtreecommitdiff
path: root/src/DefaultBtInteractive.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-03-05 15:31:09 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-03-05 15:31:09 +0000
commit74b82c44e8879d3cd28defd95b14e169f460643d (patch)
tree8c8a5693d98351df2dac167d89660a71bbfd767e /src/DefaultBtInteractive.cc
parent37a5b99f33146be3d4d14c059f5dd43a2737f89f (diff)
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)
Diffstat (limited to 'src/DefaultBtInteractive.cc')
-rw-r--r--src/DefaultBtInteractive.cc21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/DefaultBtInteractive.cc b/src/DefaultBtInteractive.cc
index ecbc1cb6..51309b2d 100644
--- a/src/DefaultBtInteractive.cc
+++ b/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);
+ }
}
}