From 29bbac19db32c6bb4c433f19f3d083fed2808873 Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Mon, 18 Jun 2007 20:25:54 +0000 Subject: [PATCH] fix type and log pad size when using encryption --- libtorrent/src/bt_peer_connection.cpp | 5 +++++ libtorrent/src/storage.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libtorrent/src/bt_peer_connection.cpp b/libtorrent/src/bt_peer_connection.cpp index 55eec74c2..9029fb265 100755 --- a/libtorrent/src/bt_peer_connection.cpp +++ b/libtorrent/src/bt_peer_connection.cpp @@ -291,6 +291,11 @@ namespace libtorrent m_DH_key_exchange.reset(new DH_key_exchange); int pad_size = std::rand() % 512; + +#ifdef TORRENT_VERBOSE_LOGGING + (*m_logger) << " pad size: " << pad_size << "\n"; +#endif + buffer::interval send_buf = allocate_send_buffer(dh_key_len + pad_size); std::copy (m_DH_key_exchange->get_local_key(), diff --git a/libtorrent/src/storage.cpp b/libtorrent/src/storage.cpp index f0f2241c0..863cc5c07 100755 --- a/libtorrent/src/storage.cpp +++ b/libtorrent/src/storage.cpp @@ -1253,7 +1253,7 @@ namespace libtorrent for (int i = 0; i < num_blocks-1; ++i) { - if (!bi[i].state == piece_picker::block_info::state_finished) continue; + if (bi[i].state != piece_picker::block_info::state_finished) continue; m_storage->read( &buf[0] , slot_index