From b80664bbaaff98eb6a92aecbeec75bb61ac85a6b Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 8 Mar 2010 03:51:07 +0000 Subject: [PATCH] save additional settings in session state --- src/session_impl.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 38b59bd1d..bb493ab07 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -649,6 +649,18 @@ namespace aux { 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) { save_struct(e["settings"], &m_settings, session_settings_map @@ -731,6 +743,14 @@ namespace aux { 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"); if (settings) {