From 1a965cc0bd2f6b92668b699499a506ea048b689e Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Sat, 1 Dec 2012 02:20:09 +0200 Subject: [PATCH 1/3] Partially revert commit aeb5fa. See issue #258. --- src/preferences/preferences.h | 2 +- src/qtlibtorrent/qbtsession.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/preferences/preferences.h b/src/preferences/preferences.h index 87bc03e9e..5d4b194b6 100755 --- a/src/preferences/preferences.h +++ b/src/preferences/preferences.h @@ -945,7 +945,7 @@ public: } uint diskCacheSize() const { - return value(QString::fromUtf8("Preferences/Downloads/DiskWriteCacheSize"), 0).toUInt(); + return value(QString::fromUtf8("Preferences/Downloads/DiskWriteCacheSize"), 16).toUInt(); } void setDiskCacheSize(uint size) { diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index 949a2614f..9eac9eaa8 100755 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -402,8 +402,7 @@ void QBtSession::configureSession() { sessionSettings.announce_to_all_trackers = announce_to_all; sessionSettings.announce_to_all_tiers = announce_to_all; sessionSettings.auto_scrape_min_interval = 900; // 15 minutes - int cache_size = pref.diskCacheSize(); - sessionSettings.cache_size = cache_size ? pref.diskCacheSize() * 64 : -1; + sessionSettings.cache_size = pref.diskCacheSize() ? pref.diskCacheSize() * 64 : -1; qDebug() << "Using a disk cache size of" << pref.diskCacheSize() << "MiB"; // Disable OS cache to avoid memory problems (uTorrent behavior) #ifdef Q_WS_WIN From 60c3244faab4a4a234f07613656d70dd32a4f5af Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Sat, 1 Dec 2012 14:11:20 +0200 Subject: [PATCH 2/3] Don't touch qbtsession here. --- src/qtlibtorrent/qbtsession.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index 9eac9eaa8..949a2614f 100755 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -402,7 +402,8 @@ void QBtSession::configureSession() { sessionSettings.announce_to_all_trackers = announce_to_all; sessionSettings.announce_to_all_tiers = announce_to_all; sessionSettings.auto_scrape_min_interval = 900; // 15 minutes - sessionSettings.cache_size = pref.diskCacheSize() ? pref.diskCacheSize() * 64 : -1; + int cache_size = pref.diskCacheSize(); + sessionSettings.cache_size = cache_size ? pref.diskCacheSize() * 64 : -1; qDebug() << "Using a disk cache size of" << pref.diskCacheSize() << "MiB"; // Disable OS cache to avoid memory problems (uTorrent behavior) #ifdef Q_WS_WIN From 38f1d2722315a310a77ecd0a4c245a4f59201a46 Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Mon, 3 Dec 2012 23:28:56 +0200 Subject: [PATCH 3/3] Make the disk cache default to 128MB. --- src/preferences/preferences.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/preferences/preferences.h b/src/preferences/preferences.h index 5d4b194b6..0d219ba36 100755 --- a/src/preferences/preferences.h +++ b/src/preferences/preferences.h @@ -945,7 +945,7 @@ public: } uint diskCacheSize() const { - return value(QString::fromUtf8("Preferences/Downloads/DiskWriteCacheSize"), 16).toUInt(); + return value(QString::fromUtf8("Preferences/Downloads/DiskWriteCacheSize"), 128).toUInt(); } void setDiskCacheSize(uint size) {