Fixes for set_queue_position()

This commit is contained in:
Andrew Resch 2008-06-11 12:14:10 +00:00
parent a4dfd63ca3
commit 933e3c8b54
1 changed files with 7 additions and 4 deletions

View File

@ -3416,7 +3416,8 @@ namespace libtorrent
{ {
torrent* t = i->second.get(); torrent* t = i->second.get();
if (t == this) continue; 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 != -1)
++t->m_sequence_number; ++t->m_sequence_number;
} }
@ -3429,15 +3430,17 @@ namespace libtorrent
, end(torrents.end()); i != end; ++i) , end(torrents.end()); i != end; ++i)
{ {
torrent* t = i->second.get(); torrent* t = i->second.get();
if (t == this) continue;
int pos = t->m_sequence_number; int pos = t->m_sequence_number;
if (pos > max_seq) max_seq = pos;
if (t == this) continue;
if (pos <= p if (pos <= p
&& pos > m_sequence_number && pos > m_sequence_number
&& pos != -1) && pos != -1)
--t->m_sequence_number; --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) if (m_ses.m_auto_manage_time_scaler > 2)