added an asynchronous save_resume_data to make it easier to synchronize with the disk IO thread

This commit is contained in:
Arvid Norberg
2008-04-13 18:54:36 +00:00
parent 6639f72804
commit 3fea2080fd
12 changed files with 657 additions and 438 deletions

View File

@@ -773,13 +773,13 @@ namespace libtorrent
std::string const& error_string = j.storage->error();
if (!error_string.empty())
{
#ifndef NDEBUG
std::cout << "ERROR: '" << error_string << "' " << j.error_file << std::endl;
#endif
j.str = error_string;
j.error_file = j.storage->error_file();
j.storage->clear_error();
ret = -1;
#ifndef NDEBUG
std::cout << "ERROR: " << error_string << " " << j.error_file << std::endl;
#endif
}
else
{
@@ -1042,6 +1042,16 @@ namespace libtorrent
}
break;
}
case disk_io_job::save_resume_data:
{
#ifdef TORRENT_DISK_STATS
m_log << log_time() << " save resume data" << std::endl;
#endif
j.resume_data.reset(new entry(entry::dictionary_t));
j.storage->write_resume_data(*j.resume_data);
ret = 0;
break;
}
}
}
#ifndef BOOST_NO_EXCEPTIONS