mirror of https://github.com/aria2/aria2
Don't try legacy BitTorrent handshake when connection did not established.
parent
ce2d401dce
commit
3020087a75
|
@ -197,12 +197,8 @@ bool InitiatorMSEHandshakeCommand::executeInternal() {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool InitiatorMSEHandshakeCommand::prepareForNextPeer(time_t wait)
|
||||
void InitiatorMSEHandshakeCommand::tryNewPeer()
|
||||
{
|
||||
if(getOption()->getAsBool(PREF_BT_REQUIRE_CRYPTO)) {
|
||||
A2_LOG_INFO(fmt("CUID#%lld - Establishing connection using legacy BitTorrent"
|
||||
" handshake is disabled by preference.",
|
||||
getCuid()));
|
||||
if(peerStorage_->isPeerAvailable() && btRuntime_->lessThanEqMinPeers()) {
|
||||
SharedHandle<Peer> peer = peerStorage_->getUnusedPeer();
|
||||
peer->usedBy(getDownloadEngine()->newCUID());
|
||||
|
@ -213,6 +209,20 @@ bool InitiatorMSEHandshakeCommand::prepareForNextPeer(time_t wait)
|
|||
command->setPieceStorage(pieceStorage_);
|
||||
getDownloadEngine()->addCommand(command);
|
||||
}
|
||||
}
|
||||
|
||||
bool InitiatorMSEHandshakeCommand::prepareForNextPeer(time_t wait)
|
||||
{
|
||||
if(sequence_ == INITIATOR_SEND_KEY) {
|
||||
// We don't try legacy handshake when connection did not
|
||||
// established.
|
||||
tryNewPeer();
|
||||
return true;
|
||||
} else if(getOption()->getAsBool(PREF_BT_REQUIRE_CRYPTO)) {
|
||||
A2_LOG_INFO(fmt("CUID#%lld - Establishing connection using legacy"
|
||||
" BitTorrent handshake is disabled by preference.",
|
||||
getCuid()));
|
||||
tryNewPeer();
|
||||
return true;
|
||||
} else {
|
||||
// try legacy BitTorrent handshake
|
||||
|
|
|
@ -70,6 +70,8 @@ private:
|
|||
MSEHandshake* mseHandshake_;
|
||||
|
||||
const SharedHandle<Option>& getOption() const;
|
||||
|
||||
void tryNewPeer();
|
||||
protected:
|
||||
virtual bool executeInternal();
|
||||
virtual bool prepareForNextPeer(time_t wait);
|
||||
|
|
Loading…
Reference in New Issue