fixes to storage state machine

This commit is contained in:
Arvid Norberg 2007-05-31 21:48:36 +00:00
parent bb25fceb3f
commit 8f4c460587
1 changed files with 32 additions and 27 deletions

View File

@ -1613,11 +1613,17 @@ namespace libtorrent
m_unallocated_slots.push_back(i);
}
if (m_compact_mode || m_unallocated_slots.empty())
if (m_unallocated_slots.empty())
{
m_state = state_finished;
return true;
}
if (m_compact_mode)
{
m_state = state_create_files;
return false;
}
}
m_current_slot = 0;
@ -1628,24 +1634,29 @@ namespace libtorrent
/*
state chart:
check_fastresume()
| |
| v
| +------------+
| | full_check |
| +------------+
| |
| v
| +------------+ +--------------+
| | allocating |-->| create_files |
| +------------+ +--------------+
| | |
| v |
| +----------+ |
+---->| finished |<--------+
+----------+
check_fastresume() ----+
|
| | |
| v |
| +------------+ |
| | full_check | |
| +------------+ |
| | |
| v |
| +------------+ |
| | allocating | |
| +------------+ |
| | |
| v |
| +--------------+ |
| | create_files |<-+
| +--------------+ |
| | |
| v |
| +----------+ |
+---->| finished |<--+
+----------+
*/
@ -1662,18 +1673,12 @@ namespace libtorrent
if (m_state == state_allocating)
{
if (m_compact_mode)
if (m_compact_mode || m_unallocated_slots.empty())
{
m_state = state_finished;
m_state = state_create_files;
return std::make_pair(true, 1.f);
}
if (m_unallocated_slots.empty())
{
m_state = state_finished;
return std::make_pair(true, 1.f);
}
if (int(m_unallocated_slots.size()) == m_info.num_pieces()
&& !m_fill_mode)
{