mirror of https://github.com/aria2/aria2
Just preset IA to PeerConnection in receiver side.
Since initiator cannot send payload stream before reading step2 from receiver, mseHandshake_->getBufferLength() should be 0.pull/1/head
parent
320ca4c5a1
commit
1818f2ed55
|
@ -213,19 +213,10 @@ void ReceiverMSEHandshakeCommand::createCommand()
|
||||||
peerConnection->enableEncryption(mseHandshake_->getEncryptor(),
|
peerConnection->enableEncryption(mseHandshake_->getEncryptor(),
|
||||||
mseHandshake_->getDecryptor());
|
mseHandshake_->getDecryptor());
|
||||||
}
|
}
|
||||||
size_t buflen = mseHandshake_->getIALength()+mseHandshake_->getBufferLength();
|
// Since initiator cannot send payload stream before reading step2
|
||||||
array_ptr<unsigned char> buffer(new unsigned char[buflen]);
|
// from receiver, mseHandshake_->getBufferLength() should be 0.
|
||||||
memcpy(buffer, mseHandshake_->getIA(), mseHandshake_->getIALength());
|
peerConnection->presetBuffer(mseHandshake_->getIA(),
|
||||||
if(mseHandshake_->getNegotiatedCryptoType() == MSEHandshake::CRYPTO_ARC4) {
|
mseHandshake_->getIALength());
|
||||||
mseHandshake_->getDecryptor()->decrypt(buffer+mseHandshake_->getIALength(),
|
|
||||||
mseHandshake_->getBufferLength(),
|
|
||||||
mseHandshake_->getBuffer(),
|
|
||||||
mseHandshake_->getBufferLength());
|
|
||||||
} else {
|
|
||||||
memcpy(buffer+mseHandshake_->getIALength(),
|
|
||||||
mseHandshake_->getBuffer(), mseHandshake_->getBufferLength());
|
|
||||||
}
|
|
||||||
peerConnection->presetBuffer(buffer, buflen);
|
|
||||||
// TODO add mseHandshake_->getInfoHash() to PeerReceiveHandshakeCommand
|
// TODO add mseHandshake_->getInfoHash() to PeerReceiveHandshakeCommand
|
||||||
// as a hint. If this info hash and one in BitTorrent Handshake does not
|
// as a hint. If this info hash and one in BitTorrent Handshake does not
|
||||||
// match, then drop connection.
|
// match, then drop connection.
|
||||||
|
|
Loading…
Reference in New Issue