From e291ab32907b10ff3aa448aace5420cc5fad4702 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 8 Jun 2014 21:15:34 +0000 Subject: [PATCH] minor streaming improvements --- src/peer_connection.cpp | 3 +-- src/torrent.cpp | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index c6d5bccdd..984b28938 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -995,8 +995,7 @@ namespace libtorrent else { // current download rate in bytes per seconds - rate = m_statistics.transfer_rate(stat::download_payload) - + m_statistics.transfer_rate(stat::download_protocol); + rate = m_statistics.transfer_rate(stat::download_payload); } // avoid division by zero diff --git a/src/torrent.cpp b/src/torrent.cpp index f3c42853f..42abb1fd5 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -8793,6 +8793,11 @@ namespace libtorrent , boost::bind(&peer_connection::download_queue_time, _1, 16*1024) < boost::bind(&peer_connection::download_queue_time, _2, 16*1024)); } + + // if this peer's download time exceeds 2 seconds, we're done. + // We don't want to build unreasonably long request queues + if (!peers.empty() && peers[0]->download_queue_time() > milliseconds(2000)) + break; } // commit all the time critical requests