diff --git a/ChangeLog b/ChangeLog index dea188316..a0ee4bf20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/src/storage.cpp b/src/storage.cpp index 43cddf09e..89235be22 100644 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -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