fix stat cache issue that sometimes would produce incorrect resume data

This commit is contained in:
arvidn 2017-01-22 20:36:40 +02:00 committed by Arvid Norberg
parent 61c057947c
commit 132be5101f
2 changed files with 6 additions and 2 deletions

View File

@ -1,3 +1,4 @@
* fix stat cache issue that sometimes would produce incorrect resume data
* storage optimization to peer classes
* fix torrent name in alerts of builds with deprecated functions
* make torrent_info::is_valid() return false if torrent failed to load

View File

@ -545,14 +545,17 @@ namespace libtorrent
file_status s;
std::string file_path = files().file_path(file_index, m_save_path);
stat_file(file_path, &s, ec.ec);
if (ec && ec.ec != boost::system::errc::no_such_file_or_directory)
if (!ec)
{
m_stat_cache.set_cache(file_index, s.file_size, s.mtime);
}
else if (ec.ec != boost::system::errc::no_such_file_or_directory)
{
m_stat_cache.set_error(file_index);
ec.file = file_index;
ec.operation = storage_error::stat;
break;
}
m_stat_cache.set_cache(file_index, s.file_size, s.mtime);
}
// if the file already exists, but is larger than what