fixed some incorrect encryption asserts

This commit is contained in:
Arvid Norberg 2010-11-14 01:06:52 +00:00
parent a4f533ce55
commit 26b48530d2
1 changed files with 7 additions and 4 deletions

View File

@ -469,7 +469,7 @@ namespace libtorrent
int pad_size = rand() % 512;
TORRENT_ASSERT(send_buffer_size() == m_encrypted_bytes);
TORRENT_ASSERT(!m_rc4_encrypted || send_buffer_size() == m_encrypted_bytes);
// synchash,skeyhash,vc,crypto_provide,len(pad),pad,len(ia)
buffer::interval send_buf =
@ -551,9 +551,9 @@ namespace libtorrent
TORRENT_ASSERT(crypto_select == 0x02 || crypto_select == 0x01);
TORRENT_ASSERT(!m_sent_handshake);
int pad_size =rand() % 512;
int pad_size = rand() % 512;
TORRENT_ASSERT(send_buffer_size() == m_encrypted_bytes);
TORRENT_ASSERT(!m_rc4_encrypted || send_buffer_size() == m_encrypted_bytes);
const int buf_size = 8 + 4 + 2 + pad_size;
buffer::interval send_buf = allocate_send_buffer(buf_size);
@ -684,7 +684,7 @@ namespace libtorrent
if (m_encrypted && m_rc4_encrypted)
{
TORRENT_ASSERT(send_buffer_size() == m_encrypted_bytes);
TORRENT_ASSERT(!m_rc4_encrypted || send_buffer_size() == m_encrypted_bytes);
m_RC4_handler->encrypt(const_cast<char*>(buf), size);
#ifdef TORRENT_DEBUG
m_encrypted_bytes += size;
@ -2547,6 +2547,9 @@ namespace libtorrent
return;
}
m_rc4_encrypted = true;
#ifdef TORRENT_DEBUG
m_encrypted_bytes = send_buffer_size();
#endif
}
else if (crypto_field == 0x01)
{