forked from premiere/premiere-libtorrent
fixed bug where mapped files were not restored properly from the resume data. Fixes #483
This commit is contained in:
parent
855e6bc345
commit
2c68654994
|
@ -56,6 +56,8 @@ release 0.14.2
|
||||||
wrong order, for encrypted connections.
|
wrong order, for encrypted connections.
|
||||||
* fixed race condition where torrents could get stuck waiting to
|
* fixed race condition where torrents could get stuck waiting to
|
||||||
get checked
|
get checked
|
||||||
|
* fixed mapped files bug where it wouldn't be properly restored
|
||||||
|
from resume data properly
|
||||||
|
|
||||||
release 0.14.1
|
release 0.14.1
|
||||||
|
|
||||||
|
|
|
@ -1867,6 +1867,9 @@ namespace libtorrent
|
||||||
|
|
||||||
dequeue_torrent_check();
|
dequeue_torrent_check();
|
||||||
|
|
||||||
|
if (m_state == torrent_status::checking_files)
|
||||||
|
set_state(torrent_status::queued_for_checking);
|
||||||
|
|
||||||
m_owning_storage = 0;
|
m_owning_storage = 0;
|
||||||
m_host_resolver.cancel();
|
m_host_resolver.cancel();
|
||||||
}
|
}
|
||||||
|
@ -2978,7 +2981,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
std::string new_filename = mapped_files->list_string_value_at(i);
|
std::string new_filename = mapped_files->list_string_value_at(i);
|
||||||
if (new_filename.empty()) continue;
|
if (new_filename.empty()) continue;
|
||||||
m_torrent_file->rename_file(i, new_filename);
|
rename_file(i, new_filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -536,13 +536,17 @@ void test_rename_file_in_fastresume(path const& test_path)
|
||||||
|
|
||||||
h.rename_file(0, "testing_renamed_files");
|
h.rename_file(0, "testing_renamed_files");
|
||||||
std::cout << "renaming file" << std::endl;
|
std::cout << "renaming file" << std::endl;
|
||||||
|
bool renamed = false;
|
||||||
for (int i = 0; i < 100; ++i)
|
for (int i = 0; i < 100; ++i)
|
||||||
{
|
{
|
||||||
if (print_alerts(ses, "ses", true, true, true, &got_file_rename_alert)) break;
|
if (print_alerts(ses, "ses", true, true, true, &got_file_rename_alert)) renamed = true;
|
||||||
test_sleep(1000);
|
test_sleep(1000);
|
||||||
torrent_status s = h.status();
|
torrent_status s = h.status();
|
||||||
|
if (s.state == torrent_status::seeding && renamed) return;
|
||||||
}
|
}
|
||||||
std::cout << "stop loop" << std::endl;
|
std::cout << "stop loop" << std::endl;
|
||||||
|
torrent_status s = h.status();
|
||||||
|
TEST_CHECK(s.state == torrent_status::seeding);
|
||||||
resume = h.write_resume_data();
|
resume = h.write_resume_data();
|
||||||
ses.remove_torrent(h);
|
ses.remove_torrent(h);
|
||||||
}
|
}
|
||||||
|
@ -565,7 +569,12 @@ void test_rename_file_in_fastresume(path const& test_path)
|
||||||
}
|
}
|
||||||
torrent_status stat = h.status();
|
torrent_status stat = h.status();
|
||||||
TEST_CHECK(stat.state == torrent_status::seeding);
|
TEST_CHECK(stat.state == torrent_status::seeding);
|
||||||
|
|
||||||
|
resume = h.write_resume_data();
|
||||||
|
ses.remove_torrent(h);
|
||||||
}
|
}
|
||||||
|
TEST_CHECK(resume.dict().find("mapped_files") != resume.dict().end());
|
||||||
|
resume.print(std::cout);
|
||||||
remove_all(test_path / "tmp2");
|
remove_all(test_path / "tmp2");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue