From 132be5101ff48ecc2831e4171c4f2043b290c6f9 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sun, 22 Jan 2017 20:36:40 +0200 Subject: [PATCH] fix stat cache issue that sometimes would produce incorrect resume data --- ChangeLog | 1 + src/storage.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) 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