fixed bug where mapped files were not restored properly from the resume data. Fixes #483

This commit is contained in:
Arvid Norberg 2009-02-09 06:19:31 +00:00
parent 855e6bc345
commit 2c68654994
3 changed files with 16 additions and 2 deletions

View File

@ -56,6 +56,8 @@ release 0.14.2
wrong order, for encrypted connections.
* fixed race condition where torrents could get stuck waiting to
get checked
* fixed mapped files bug where it wouldn't be properly restored
from resume data properly
release 0.14.1

View File

@ -1867,6 +1867,9 @@ namespace libtorrent
dequeue_torrent_check();
if (m_state == torrent_status::checking_files)
set_state(torrent_status::queued_for_checking);
m_owning_storage = 0;
m_host_resolver.cancel();
}
@ -2978,7 +2981,7 @@ namespace libtorrent
{
std::string new_filename = mapped_files->list_string_value_at(i);
if (new_filename.empty()) continue;
m_torrent_file->rename_file(i, new_filename);
rename_file(i, new_filename);
}
}

View File

@ -536,13 +536,17 @@ void test_rename_file_in_fastresume(path const& test_path)
h.rename_file(0, "testing_renamed_files");
std::cout << "renaming file" << std::endl;
bool renamed = false;
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);
torrent_status s = h.status();
if (s.state == torrent_status::seeding && renamed) return;
}
std::cout << "stop loop" << std::endl;
torrent_status s = h.status();
TEST_CHECK(s.state == torrent_status::seeding);
resume = h.write_resume_data();
ses.remove_torrent(h);
}
@ -565,7 +569,12 @@ void test_rename_file_in_fastresume(path const& test_path)
}
torrent_status stat = h.status();
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");
}