diff --git a/src/core/bittorrent/session.cpp b/src/core/bittorrent/session.cpp index 847f4d7ed..126f5be9b 100644 --- a/src/core/bittorrent/session.cpp +++ b/src/core/bittorrent/session.cpp @@ -174,9 +174,6 @@ Session::Session(QObject *parent) m_nativeSession->set_alert_dispatch(boost::bind(&Session::dispatchAlerts, this, _1)); - // Load previous state - loadState(); - // Enabling plugins //m_nativeSession->add_extension(&libt::create_metadata_plugin); m_nativeSession->add_extension(&libt::create_ut_metadata_plugin); @@ -271,7 +268,6 @@ qreal Session::globalMaxRatio() const Session::~Session() { // Do some BT related saving - saveState(); saveResumeData(); // We must delete FilterParserThread @@ -309,46 +305,6 @@ Session *Session::instance() return m_instance; } -void Session::loadState() -{ - const QString statePath = Utils::Fs::cacheLocation() + QLatin1String("/ses_state"); - if (!QFile::exists(statePath)) return; - - if (QFile(statePath).size() == 0) { - // Remove empty invalid state file - Utils::Fs::forceRemove(statePath); - return; - } - - QFile file(statePath); - if (file.open(QIODevice::ReadOnly)) { - QByteArray buf = file.readAll(); - // bdecode - libt::lazy_entry entry; - libt::error_code ec; - libt::lazy_bdecode(buf.constData(), buf.constData() + buf.size(), entry, ec); - if (!ec) - m_nativeSession->load_state(entry); - } -} - -void Session::saveState() -{ - qDebug("Saving session state to disk..."); - - const QString state_path = Utils::Fs::cacheLocation() + QLatin1String("/ses_state"); - libt::entry session_state; - m_nativeSession->save_state(session_state); - std::vector out; - libt::bencode(std::back_inserter(out), session_state); - - QFile session_file(state_path); - if (!out.empty() && session_file.open(QIODevice::WriteOnly)) { - session_file.write(&out[0], out.size()); - session_file.close(); - } -} - void Session::setSessionSettings() { Preferences* const pref = Preferences::instance(); diff --git a/src/core/bittorrent/session.h b/src/core/bittorrent/session.h index f2bf587e5..1041df467 100644 --- a/src/core/bittorrent/session.h +++ b/src/core/bittorrent/session.h @@ -266,8 +266,6 @@ namespace BitTorrent bool hasPerTorrentRatioLimit() const; void initResumeFolder(); - void loadState(); - void saveState(); // Session configuration void setSessionSettings();