summaryrefslogtreecommitdiff
path: root/trackerlogic.c
diff options
context:
space:
mode:
Diffstat (limited to 'trackerlogic.c')
-rw-r--r--trackerlogic.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/trackerlogic.c b/trackerlogic.c
index 7b5b94a..b9f14f0 100644
--- a/trackerlogic.c
+++ b/trackerlogic.c
@@ -210,6 +210,10 @@ size_t return_peers_for_torrent( ot_torrent *torrent, unsigned long amount, char
210 off = 1 + ( off % ( peer_count - wert - 1 )); 210 off = 1 + ( off % ( peer_count - wert - 1 ));
211 wert += off; pool_offset += off; 211 wert += off; pool_offset += off;
212 212
213 // In some rare occasions random gets the last peer a round to early
214 // correct that and return last peer twice
215 if( wert >= peer_count ) { wert--; pool_offset--; }
216
213 while( pool_offset >= torrent->peer_list->peers[pool_index].size ) { 217 while( pool_offset >= torrent->peer_list->peers[pool_index].size ) {
214 pool_offset -= torrent->peer_list->peers[pool_index].size; 218 pool_offset -= torrent->peer_list->peers[pool_index].size;
215 pool_index++; 219 pool_index++;