storage fix

This commit is contained in:
Arvid Norberg 2008-03-25 04:45:46 +00:00
parent 5860ca8706
commit d5d450b483
1 changed files with 5 additions and 4 deletions

View File

@ -2212,6 +2212,7 @@ namespace libtorrent
{ {
TORRENT_ASSERT(m_storage_mode == storage_mode_compact); TORRENT_ASSERT(m_storage_mode == storage_mode_compact);
TORRENT_ASSERT(m_unallocated_slots.empty()); TORRENT_ASSERT(m_unallocated_slots.empty());
TORRENT_ASSERT(m_free_slots.empty());
// we have allocated all slots, switch to // we have allocated all slots, switch to
// full allocation mode in order to free // full allocation mode in order to free
// some unnecessary memory. // some unnecessary memory.
@ -2330,10 +2331,8 @@ namespace libtorrent
TORRENT_ASSERT(slot_index >= 0); TORRENT_ASSERT(slot_index >= 0);
TORRENT_ASSERT(slot_index < (int)m_slot_to_piece.size()); TORRENT_ASSERT(slot_index < (int)m_slot_to_piece.size());
if (m_unallocated_slots.empty()) if (m_free_slots.empty() && m_unallocated_slots.empty())
{
switch_to_full_mode(); switch_to_full_mode();
}
return slot_index; return slot_index;
} }
@ -2400,7 +2399,9 @@ namespace libtorrent
TORRENT_ASSERT(m_current_slot <= m_info->num_pieces()); TORRENT_ASSERT(m_current_slot <= m_info->num_pieces());
if (m_unallocated_slots.empty() && m_state == state_finished) if (m_unallocated_slots.empty()
&& m_free_slots.empty()
&& m_state == state_finished)
{ {
TORRENT_ASSERT(m_storage_mode != storage_mode_compact); TORRENT_ASSERT(m_storage_mode != storage_mode_compact);
} }