From 803a65bff95a4339bd9edda78713c4d2bcf8d593 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 1 Feb 2004 16:48:59 +0000 Subject: [PATCH] *** empty log message *** --- src/policy.cpp | 6 +++--- src/storage.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/policy.cpp b/src/policy.cpp index 7dccb3401..a70c8fc1b 100755 --- a/src/policy.cpp +++ b/src/policy.cpp @@ -89,9 +89,9 @@ namespace , peer_connection& c , std::vector ignore = std::vector()) { - float time_for_last_piece = to_seconds(c.last_piece_time()); - if (time_for_last_piece == 0) time_for_last_piece = 0.001f; - const float rate = 1.f / time_for_last_piece; + float piece_time = to_seconds(c.last_piece_time()); + if (piece_time == 0) piece_time = 0.00001f; + const float rate = 1.f / piece_time; // this will make the number of requests linearly dependent // on the rate in which we download from the peer. 2.5kB/s and diff --git a/src/storage.cpp b/src/storage.cpp index c760f843b..b6eca6bde 100755 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -250,7 +250,7 @@ namespace libtorrent std::random_shuffle(pieces.begin(), pieces.end()); std::random_shuffle(targets.begin(), targets.end()); - for (int i = 0; i < num_pieces / 4; ++i) + for (int i = 0; i < std::max(num_pieces / 100, 1); ++i) { const int slot_index = targets[i]; const int piece_index = pieces[i];