only finalize files while downloading (not while checking)

This commit is contained in:
Arvid Norberg 2012-04-04 05:32:06 +00:00
parent 75f110f48e
commit f7739a5699
1 changed files with 6 additions and 1 deletions

View File

@ -3079,7 +3079,12 @@ namespace libtorrent
{
if (!m_torrent_file->files().at(file_index).pad_file)
{
if (m_owning_storage.get())
// don't finalize files if we discover that they exist
// in whole (i.e. while checking). In that case, just assume
// they were finalized when they completed.
// The main purpose of finalizing files is to clear the sparse
// flag on windows, which only needs to be done once
if (m_owning_storage.get() && m_state == torrent_status::downloading)
m_storage->async_finalize_file(file_index);
if (m_ses.m_alerts.should_post<piece_finished_alert>())