mirror of https://github.com/aria2/aria2
2008-06-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Always Connect to _numNewConnection * src/ActivePeerConnectionCommand.ccpull/1/head
parent
ba158dbfc1
commit
4a454e94b7
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue