From 4a454e94b71d45297b9d782f002a008edcfb1c75 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 5 Jun 2008 13:02:49 +0000 Subject: [PATCH] 2008-06-05 Tatsuhiro Tsujikawa Always Connect to _numNewConnection * src/ActivePeerConnectionCommand.cc --- ChangeLog | 5 +++++ src/ActivePeerConnectionCommand.cc | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 39a3fee2..c96bd2c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-06-05 Tatsuhiro Tsujikawa + + Always Connect to _numNewConnection + * src/ActivePeerConnectionCommand.cc + 2008-06-05 Tatsuhiro Tsujikawa Made `begin' unsigned int. diff --git a/src/ActivePeerConnectionCommand.cc b/src/ActivePeerConnectionCommand.cc index a7b16aa4..7b8fc871 100644 --- a/src/ActivePeerConnectionCommand.cc +++ b/src/ActivePeerConnectionCommand.cc @@ -78,9 +78,10 @@ bool ActivePeerConnectionCommand::execute() { if(!pieceStorage->downloadFinished() && checkPoint.elapsed(interval)) { checkPoint.reset(); TransferStat tstat = peerStorage->calculateStat(); - size_t numAdd = btRuntime->lessThanEqMinPeer() ? MIN_PEERS-btRuntime->getConnections():_numNewConnection; - if(tstat.getDownloadSpeed() < _thresholdSpeed || btRuntime->lessThanEqMinPeer()) { - for(; numAdd > 0 && peerStorage->isPeerAvailable(); --numAdd) { + if(tstat.getDownloadSpeed() < _thresholdSpeed || + btRuntime->lessThanMinPeer()) { + for(size_t numAdd = _numNewConnection; + numAdd > 0 && peerStorage->isPeerAvailable(); --numAdd) { PeerHandle peer = peerStorage->getUnusedPeer(); connectToPeer(peer); }