diff options
Diffstat (limited to 'src/PeerReceiveHandshakeCommand.cc')
| -rw-r--r-- | src/PeerReceiveHandshakeCommand.cc | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/PeerReceiveHandshakeCommand.cc b/src/PeerReceiveHandshakeCommand.cc index 81d9fb72..edb19756 100644 --- a/src/PeerReceiveHandshakeCommand.cc +++ b/src/PeerReceiveHandshakeCommand.cc @@ -77,21 +77,22 @@ bool PeerReceiveHandshakeCommand::executeInternal() if(!PIECE_STORAGE(btContext)->downloadFinished() && tstat.getDownloadSpeed() < _lowestSpeedLimit || BT_RUNTIME(btContext)->getConnections() < MAX_PEERS) { peer->reconfigure(btContext->getPieceLength(), btContext->getTotalLength()); - PEER_STORAGE(btContext)->addIncomingPeer(peer); + if(PEER_STORAGE(btContext)->addIncomingPeer(peer)) { - peer->cuid = cuid; - - PeerInteractionCommand* command = - new PeerInteractionCommand(cuid, - btContext->getOwnerRequestGroup(), - peer, - e, - btContext, - socket, - PeerInteractionCommand::RECEIVER_WAIT_HANDSHAKE, - _peerConnection); - e->commands.push_back(command); - logger->debug(MSG_INCOMING_PEER_CONNECTION, cuid, peer->cuid); + peer->cuid = cuid; + + PeerInteractionCommand* command = + new PeerInteractionCommand(cuid, + btContext->getOwnerRequestGroup(), + peer, + e, + btContext, + socket, + PeerInteractionCommand::RECEIVER_WAIT_HANDSHAKE, + _peerConnection); + e->commands.push_back(command); + logger->debug(MSG_INCOMING_PEER_CONNECTION, cuid, peer->cuid); + } } return true; } else { |
