mirror of https://github.com/aria2/aria2
Code cleanup
parent
de394bbf61
commit
8524ac3806
|
@ -115,9 +115,11 @@ bool ActivePeerConnectionCommand::execute() {
|
||||||
numConnection = numNewConnection_;
|
numConnection = numNewConnection_;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int numAdd = numConnection;
|
for(; numConnection > 0; --numConnection) {
|
||||||
numAdd > 0 && peerStorage_->isPeerAvailable(); --numAdd) {
|
|
||||||
SharedHandle<Peer> peer = peerStorage_->getUnusedPeer();
|
SharedHandle<Peer> peer = peerStorage_->getUnusedPeer();
|
||||||
|
if(!peer) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
connectToPeer(peer);
|
connectToPeer(peer);
|
||||||
}
|
}
|
||||||
if(btRuntime_->getConnections() == 0 &&
|
if(btRuntime_->getConnections() == 0 &&
|
||||||
|
@ -132,9 +134,6 @@ bool ActivePeerConnectionCommand::execute() {
|
||||||
|
|
||||||
void ActivePeerConnectionCommand::connectToPeer(const SharedHandle<Peer>& peer)
|
void ActivePeerConnectionCommand::connectToPeer(const SharedHandle<Peer>& peer)
|
||||||
{
|
{
|
||||||
if(!peer) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
peer->usedBy(e_->newCUID());
|
peer->usedBy(e_->newCUID());
|
||||||
PeerInitiateConnectionCommand* command =
|
PeerInitiateConnectionCommand* command =
|
||||||
new PeerInitiateConnectionCommand(peer->usedBy(), requestGroup_, peer, e_,
|
new PeerInitiateConnectionCommand(peer->usedBy(), requestGroup_, peer, e_,
|
||||||
|
|
Loading…
Reference in New Issue