From 0882d02c53bbe6f356f5e5506fae3939effe3ac2 Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Tue, 7 Jun 2016 18:44:39 -0400 Subject: [PATCH] early resume data reset when fatal_disk_error (#798) --- simulation/libsimulator | 2 +- src/torrent.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/simulation/libsimulator b/simulation/libsimulator index ea3bffe3c..f0e42435d 160000 --- a/simulation/libsimulator +++ b/simulation/libsimulator @@ -1 +1 @@ -Subproject commit ea3bffe3c53bca5e0976914ea951193ba43fbed6 +Subproject commit f0e42435dce3ff227cc81b17ccab143b21d8f771 diff --git a/src/torrent.cpp b/src/torrent.cpp index f3f7aaeec..535524b6a 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -1749,7 +1749,7 @@ namespace libtorrent #endif } - m_block_size_shift = root2((std::min)(int(block_size()), m_torrent_file->piece_length())); + m_block_size_shift = root2((std::min)(block_size(), m_torrent_file->piece_length())); if (m_torrent_file->num_pieces() > piece_picker::max_pieces) { @@ -2186,6 +2186,7 @@ namespace libtorrent if (j->ret == piece_manager::fatal_disk_error) { + m_resume_data.reset(); handle_disk_error(j); auto_managed(false); pause(); @@ -2303,8 +2304,7 @@ namespace libtorrent // --- UNFINISHED PIECES --- - int const num_blocks_per_piece = - static_cast(torrent_file().piece_length()) / block_size(); + int const num_blocks_per_piece = torrent_file().piece_length() / block_size(); for (std::map::const_iterator i = m_add_torrent_params->unfinished_pieces.begin()