From 0b528b2f6164c0d1e8e70642288af8ad116ad9f0 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Fri, 13 Feb 2009 17:41:09 +0000 Subject: lt sync 3259 --- libtorrent/src/bt_peer_connection.cpp | 10 +++++++++- libtorrent/src/lsd.cpp | 7 ++++--- libtorrent/src/session_impl.cpp | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/libtorrent/src/bt_peer_connection.cpp b/libtorrent/src/bt_peer_connection.cpp index 28e1aae24..6e668fbf0 100755 --- a/libtorrent/src/bt_peer_connection.cpp +++ b/libtorrent/src/bt_peer_connection.cpp @@ -634,6 +634,7 @@ namespace libtorrent encrypt_pending_buffer(); +#ifndef TORRENT_DISABLE_ENCRYPTION if (m_encrypted && m_rc4_encrypted) { TORRENT_ASSERT(send_buffer_size() == m_encrypted_bytes); @@ -642,12 +643,14 @@ namespace libtorrent m_encrypted_bytes += size; #endif } +#endif peer_connection::send_buffer(buf, size, flags); } buffer::interval bt_peer_connection::allocate_send_buffer(int size) { +#ifndef TORRENT_DISABLE_ENCRYPTION encrypt_pending_buffer(); if (m_encrypted && m_rc4_encrypted) { @@ -656,12 +659,14 @@ namespace libtorrent return m_enc_send_buffer; } else +#endif { buffer::interval i = peer_connection::allocate_send_buffer(size); return i; } } +#ifndef TORRENT_DISABLE_ENCRYPTION void bt_peer_connection::encrypt_pending_buffer() { if (m_encrypted && m_rc4_encrypted && m_enc_send_buffer.left()) @@ -679,11 +684,14 @@ namespace libtorrent m_enc_send_buffer.end = m_enc_send_buffer.begin; } } +#endif void bt_peer_connection::setup_send() { +#ifndef TORRENT_DISABLE_ENCRYPTION encrypt_pending_buffer(); TORRENT_ASSERT(!m_encrypted || !m_rc4_encrypted || m_encrypted_bytes == send_buffer_size()); +#endif peer_connection::setup_send(); } @@ -2676,7 +2684,7 @@ namespace libtorrent std::remove_if(m_payloads.begin(), m_payloads.end(), range_below_zero) , m_payloads.end()); -#ifdef TORRENT_DEBUG +#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_ENCRYPTION if (m_encrypted_bytes > 0) { if (m_rc4_encrypted) diff --git a/libtorrent/src/lsd.cpp b/libtorrent/src/lsd.cpp index 0e63d4856..5f5aa9e9e 100644 --- a/libtorrent/src/lsd.cpp +++ b/libtorrent/src/lsd.cpp @@ -37,6 +37,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/http_tracker_connection.hpp" #include "libtorrent/buffer.hpp" #include "libtorrent/http_parser.hpp" +#include "libtorrent/escape_string.hpp" #include #include @@ -85,7 +86,7 @@ void lsd::announce(sha1_hash const& ih, int listen_port) std::stringstream btsearch; btsearch << "BT-SEARCH * HTTP/1.1\r\n" "Host: 239.192.152.143:6771\r\n" - "Port: " << listen_port << "\r\n" + "Port: " << to_string(listen_port).elems << "\r\n" "Infohash: " << ih << "\r\n" "\r\n\r\n"; std::string const& msg = btsearch.str(); @@ -101,7 +102,7 @@ void lsd::announce(sha1_hash const& ih, int listen_port) #if defined(TORRENT_LOGGING) || defined(TORRENT_VERBOSE_LOGGING) m_log << time_now_string() - << " ==> announce: ih: " << ih << " port: " << listen_port << std::endl; + << " ==> announce: ih: " << ih << " port: " << to_string(listen_port).elems << std::endl; #endif m_broadcast_timer.expires_from_now(milliseconds(250 * m_retry_count), ec); @@ -182,7 +183,7 @@ void lsd::on_announce(udp::endpoint const& from, char* buffer #if defined(TORRENT_LOGGING) || defined(TORRENT_VERBOSE_LOGGING) m_log << time_now_string() << " *** incoming local announce " << from.address() - << ":" << port << " ih: " << ih << std::endl; + << ":" << to_string(port).elems << " ih: " << ih << std::endl; #endif // we got an announce, pass it on through the callback #ifndef BOOST_NO_EXCEPTIONS diff --git a/libtorrent/src/session_impl.cpp b/libtorrent/src/session_impl.cpp index 86515aee4..4bb8caf00 100755 --- a/libtorrent/src/session_impl.cpp +++ b/libtorrent/src/session_impl.cpp @@ -1715,7 +1715,7 @@ namespace aux { { TORRENT_ASSERT(!params.save_path.empty()); - if (params.ti && params.ti->files().num_files() == 0) + if (params.ti && params.ti->num_files() == 0) { #ifndef BOOST_NO_EXCEPTIONS throw std::runtime_error("no files in torrent"); -- cgit