fix issue of null m_part_file in default_storage readv/writev (#2490)

call need_partfile if necessary in default_storage constructor and no .reset() in release_files()
This commit is contained in:
Alden Torres 2017-10-31 11:49:58 -04:00 committed by Arvid Norberg
parent 7aa5570589
commit f02e7514e1
2 changed files with 11 additions and 2 deletions

View File

@ -89,6 +89,16 @@ namespace libtorrent {
TORRENT_ASSERT(files().num_files() > 0);
m_save_path = complete(params.path);
m_part_file_name = "." + aux::to_hex(params.info_hash) + ".parts";
file_storage const& fs = files();
for (file_index_t i(0); i < m_file_priority.end_index(); ++i)
{
if (m_file_priority[i] == 0 && !fs.pad_file_at(i))
{
need_partfile();
break;
}
}
}
default_storage::~default_storage()
@ -382,7 +392,6 @@ namespace libtorrent {
{
error_code ignore;
m_part_file->flush_metadata(ignore);
m_part_file.reset();
}
// make sure we don't have the files open

View File

@ -123,7 +123,7 @@ void test_transfer(settings_pack const& sett, bool test_deprecated = false)
file.close();
wait_for_listen(ses1, "ses1");
wait_for_listen(ses2, "ses1");
wait_for_listen(ses2, "ses2");
peer_disconnects = 0;