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

Always Connect to _numNewConnection 
	* src/ActivePeerConnectionCommand.cc
pull/1/head
Tatsuhiro Tsujikawa 2008-06-05 13:02:49 +00:00
parent ba158dbfc1
commit 4a454e94b7
2 changed files with 9 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2008-06-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Always Connect to _numNewConnection
* src/ActivePeerConnectionCommand.cc
2008-06-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Made `begin' unsigned int.

View File

@ -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);
}