From 37df050e3bd500bdb10772e1d919f9dbe8823d2a Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Wed, 11 Jun 2008 12:13:26 +0000 Subject: [PATCH] Fixes for set_queue_position() --- libtorrent/src/torrent.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libtorrent/src/torrent.cpp b/libtorrent/src/torrent.cpp index b3a81fdfc..7e74379ba 100755 --- a/libtorrent/src/torrent.cpp +++ b/libtorrent/src/torrent.cpp @@ -3416,7 +3416,8 @@ namespace libtorrent { torrent* t = i->second.get(); if (t == this) continue; - if (t->m_sequence_number >= p + if (t->m_sequence_number >= p + && t->m_sequence_number < m_sequence_number && t->m_sequence_number != -1) ++t->m_sequence_number; } @@ -3429,15 +3430,17 @@ namespace libtorrent , end(torrents.end()); i != end; ++i) { torrent* t = i->second.get(); - if (t == this) continue; int pos = t->m_sequence_number; + if (pos > max_seq) max_seq = pos; + if (t == this) continue; + if (pos <= p && pos > m_sequence_number && pos != -1) --t->m_sequence_number; - if (pos > max_seq) max_seq = pos; + } - m_sequence_number = (std::min)(max_seq + 1, p); + m_sequence_number = (std::min)(max_seq, p); } if (m_ses.m_auto_manage_time_scaler > 2)