Browse Source

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.
Tatsuhiro Tsujikawa 12 years ago
parent
commit
550ac8c074
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/InitiatorMSEHandshakeCommand.cc

+ 2 - 1
src/InitiatorMSEHandshakeCommand.cc

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