Fix bug returnPeer is not called if sequence_ == INITIATOR_SEND_KEY

In InitiatorMSEHandshakeCommand, when aborting connection, we must
return peer to the PeerStorage. But it is not done if sequence_ is
INITIATOR_SEND_KEY. This causes stale Peer objects whose usedBy()
returns true eventually occupies peer list and aria2 cannot make any
connections.
pull/43/head
Tatsuhiro Tsujikawa 2013-01-25 00:01:43 +09:00
parent 32a3c441af
commit 550ac8c074
1 changed files with 2 additions and 1 deletions

View File

@ -238,7 +238,8 @@ bool InitiatorMSEHandshakeCommand::prepareForNextPeer(time_t wait)
void InitiatorMSEHandshakeCommand::onAbort()
{
if(getOption()->getAsBool(PREF_BT_REQUIRE_CRYPTO)) {
if(sequence_ == INITIATOR_SEND_KEY ||
getOption()->getAsBool(PREF_BT_REQUIRE_CRYPTO)) {
peerStorage_->returnPeer(getPeer());
}
}