Forked from sormy/libtorrent-sequential-download.patch
Created
April 28, 2021 15:19
-
-
Save digitalnomad91/7952226867e223db1f2a8bce15e623c0 to your computer and use it in GitHub Desktop.
rtorrent/libtorrent sequential download patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/download/chunk_selector.cc b/src/download/chunk_selector.cc | |
index 850fec0f..248a29f9 100644 | |
--- a/src/download/chunk_selector.cc | |
+++ b/src/download/chunk_selector.cc | |
@@ -82,7 +82,7 @@ ChunkSelector::update_priorities() { | |
m_sharedQueue.clear(); | |
if (m_position == invalid_chunk) | |
- m_position = random() % size(); | |
+ m_position = 0; | |
advance_position(); | |
} | |
@@ -100,14 +100,6 @@ ChunkSelector::find(PeerChunks* pc, __UNUSED bool highPriority) { | |
// set. | |
rak::partial_queue* queue = pc->is_seeder() ? &m_sharedQueue : pc->download_cache(); | |
- // Randomize position on average every 16 chunks to prevent | |
- // inefficient distribution with a slow seed and fast peers | |
- // all arriving at the same position. | |
- if ((random() & 63) == 0) { | |
- m_position = random() % size(); | |
- queue->clear(); | |
- } | |
- | |
if (queue->is_enabled()) { | |
// First check the cached queue. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment