mirror of https://github.com/aria2/aria2
2008-02-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed the previous insufficient fix for possible busy loop. * src/MSEHandshake.cc (identifyHandshakeType) Removed unused functions. * src/MSEHandshake.{h, cc} (readDataAndDecrypt)pull/1/head
parent
50bb9bd36d
commit
c766d945ef
|
@ -1,3 +1,11 @@
|
|||
2008-02-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Fixed the previous insufficient fix for possible busy loop.
|
||||
* src/MSEHandshake.cc (identifyHandshakeType)
|
||||
|
||||
Removed unused functions.
|
||||
* src/MSEHandshake.{h, cc} (readDataAndDecrypt)
|
||||
|
||||
2008-02-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Fixed possible busy loop if first 20 bytes are not received for a few
|
||||
|
|
|
@ -91,9 +91,12 @@ MSEHandshake::HANDSHAKE_TYPE MSEHandshake::identifyHandshakeType()
|
|||
if(!_socket->isReadable(0)) {
|
||||
return HANDSHAKE_NOT_YET;
|
||||
}
|
||||
int32_t bufLength = 20-_rbufLength;
|
||||
_socket->readData(_rbuf+_rbufLength, bufLength);
|
||||
_rbufLength += bufLength;
|
||||
int32_t r = 20-_rbufLength;
|
||||
_socket->readData(_rbuf+_rbufLength, r);
|
||||
if(r == 0) {
|
||||
throw new DlAbortEx(EX_EOF_FROM_PEER);
|
||||
}
|
||||
_rbufLength += r;
|
||||
if(_rbufLength < 20) {
|
||||
return HANDSHAKE_NOT_YET;
|
||||
}
|
||||
|
@ -180,16 +183,6 @@ void MSEHandshake::initCipher(const unsigned char* infoHash)
|
|||
}
|
||||
}
|
||||
|
||||
ssize_t MSEHandshake::readDataAndDecrypt(unsigned char* data, size_t length)
|
||||
{
|
||||
unsigned char temp[MAX_BUFFER_LENGTH];
|
||||
assert(MAX_BUFFER_LENGTH >= length);
|
||||
int32_t rlength = length;
|
||||
_socket->readData(temp, rlength);
|
||||
_decryptor->decrypt(data, rlength, temp, rlength);
|
||||
return rlength;
|
||||
}
|
||||
|
||||
void MSEHandshake::encryptAndSendData(const unsigned char* data, size_t length)
|
||||
{
|
||||
unsigned char temp[4096];
|
||||
|
|
|
@ -102,8 +102,6 @@ private:
|
|||
|
||||
static const unsigned char VC[VC_LENGTH];
|
||||
|
||||
ssize_t readDataAndDecrypt(unsigned char* data, size_t length);
|
||||
|
||||
void encryptAndSendData(const unsigned char* data, size_t length);
|
||||
|
||||
void createReq1Hash(unsigned char* md) const;
|
||||
|
|
Loading…
Reference in New Issue