save additional settings in session state

This commit is contained in:
Arvid Norberg 2010-03-08 03:51:07 +00:00
parent 6e3882a197
commit b80664bbaa
1 changed files with 20 additions and 0 deletions

View File

@ -649,6 +649,18 @@ namespace aux {
void session_impl::save_state(entry& e, boost::uint32_t flags, mutex::scoped_lock& l) const void session_impl::save_state(entry& e, boost::uint32_t flags, mutex::scoped_lock& l) const
{ {
if (flags & session::save_settings)
{
// TODO: move these to session_settings
e["upload_rate_limit"] = upload_rate_limit();
e["download_rate_limit"] = upload_rate_limit();
e["local_upload_rate_limit"] = local_upload_rate_limit();
e["local_download_rate_limit"] = local_upload_rate_limit();
e["max_uploads"] = max_uploads();
e["max_half_open_connections"] = max_half_open_connections();
e["max_connections"] = max_connections();
}
if (flags & session::save_settings) if (flags & session::save_settings)
{ {
save_struct(e["settings"], &m_settings, session_settings_map save_struct(e["settings"], &m_settings, session_settings_map
@ -731,6 +743,14 @@ namespace aux {
if (e.type() != lazy_entry::dict_t) return; if (e.type() != lazy_entry::dict_t) return;
set_upload_rate_limit(e.dict_find_int_value("upload_rate_limit", 0));
set_download_rate_limit(e.dict_find_int_value("download_rate_limit", 0));
set_local_upload_rate_limit(e.dict_find_int_value("local_upload_rate_limit", 0));
set_local_download_rate_limit(e.dict_find_int_value("local_download_rate_limit", 0));
set_max_uploads(e.dict_find_int_value("max_uploads", 0));
set_max_half_open_connections(e.dict_find_int_value("max_half_open_connections", 0));
set_max_connections(e.dict_find_int_value("max_connections", 0));
settings = e.dict_find_dict("settings"); settings = e.dict_find_dict("settings");
if (settings) if (settings)
{ {