1
mirror of https://github.com/qbittorrent/qBittorrent synced 2025-10-23 22:32:16 +02:00

Compare commits

..

11 Commits

Author SHA1 Message Date
sledgehammer999
dbfaf35db4 Fix Changelog date and entry. 2017-09-07 19:13:59 +03:00
sledgehammer999
f3b4c4acfc Fix broken build. 2017-09-06 14:50:10 +03:00
sledgehammer999
b37c395118 Bump to 3.3.16 2017-09-05 22:22:04 +03:00
sledgehammer999
d6ab0d6f02 Update Changelog. 2017-09-05 22:22:03 +03:00
Chocobo1
1b8c61c390 Setup parent ownership to avoid memory leak 2017-09-05 22:00:48 +03:00
Vladimir Golovnev
cbfdc8f721 Skip user input events when adding torrent
Closes #7327.
2017-09-05 22:00:37 +03:00
Evengard
cfae8c6399 Disable skipping of loopback interfaces
This fixes the absence of VPN tunnel interfaces under Windows and works around the QTBUG-32349
Fixes #7291
2017-09-05 22:00:10 +03:00
Chocobo1
246a19d685 WebAPI: fix validating wrong header field. Closes #7311.
X-Forwarded-Host is a foreign proxy setting, it isn't the same as
qbt's local setting and thus it makes no sense to verify it.
2017-09-05 21:57:28 +03:00
sledgehammer999
8b6e06cfff Options to better memory control by libtorrent. Closes #7029. 2017-09-05 21:57:16 +03:00
sledgehammer999
7e8f2ecc76 Fix connection problems when a specific interface/ip is configured.
Closes #7235.
Bug related to #7099 and Qt.
2017-09-05 21:57:07 +03:00
vlakoff
0f061aa40d Windows installer: also detect running process when it is 64-bit
Replacing FindProcDLL with a different one that can be found here:

http://forums.winamp.com/showthread.php?t=322583#post2777719
2017-09-05 21:54:35 +03:00
12 changed files with 109 additions and 27 deletions

View File

@@ -1,3 +1,12 @@
* Thu Sep 07 2017 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v3.3.16
- BUGFIX: Better memory footprint when using libtorrent 1.1.x. The cache is turned off by default(`0 (disabled)` value in the settings). The value `-1 (auto)` makes it use 1/8 of your RAM. (sledgehammer999)
- BUGFIX: Skip user input events when adding torrent. Closes #7327. (glassez)
- BUGFIX: Avoid memory leak in the speed graph. (Chocobo1)
- WEBUI: Fix validating wrong header field. X-Forwarded-Host is a foreign proxy setting, it isn't the same as qbt's local setting and thus it makes no sense to verify it. Closes #7311. (Chocobo1)
- WINDOWS: Fix connection problems when a specific interface/ip is configured. (sledgehammer999)
- WINDOWS: Disable skipping of loopback interfaces. This fixes the absence of VPN tunnel interfaces under Windows and works around the QTBUG-32349. Fixes #7291. (Evengard)
- WINDOWS: The installer detects the 64bit running process too. (vlakoff)
* Thu Aug 03 2017 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v3.3.15
- BUGFIX: Temporary subfolder wasn't being deleted. (glassez)

2
dist/mac/Info.plist vendored
View File

@@ -45,7 +45,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.3.15</string>
<string>3.3.16</string>
<key>CFBundleSignature</key>
<string>qBit</string>
<key>CFBundleExecutable</key>

Binary file not shown.

View File

@@ -27,7 +27,7 @@ XPStyle on
!define CSIDL_LOCALAPPDATA '0x1C' ;Local Application Data path
; Program specific
!define PROG_VERSION "3.3.15"
!define PROG_VERSION "3.3.16"
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION PageFinishRun

View File

@@ -42,6 +42,7 @@
#include <QString>
#include <QThread>
#include <QTimer>
#include <QUuid>
#include <cstdlib>
#include <queue>
@@ -88,6 +89,14 @@
#include "tracker.h"
#include "trackerentry.h"
#ifdef Q_OS_WIN
#include <iphlpapi.h>
#endif
#if defined(Q_OS_WIN) && (_WIN32_WINNT < 0x0600)
using NETIO_STATUS = LONG;
#endif
static const char PEER_ID[] = "qB";
static const char RESUME_FOLDER[] = "BT_backup";
static const char USER_AGENT[] = "qBittorrent/" QBT_VERSION_2;
@@ -105,6 +114,10 @@ namespace
void torrentQueuePositionTop(const libt::torrent_handle &handle);
void torrentQueuePositionBottom(const libt::torrent_handle &handle);
#ifdef Q_OS_WIN
QString convertIfaceNameToGuid(const QString &name);
#endif
inline SettingsStorage *settings() { return SettingsStorage::instance(); }
QStringMap map_cast(const QVariantMap &map)
@@ -313,6 +326,10 @@ Session::Session(QObject *parent)
sessionSettings.connection_speed = 20; // default is 10
sessionSettings.no_connect_privileged_ports = false;
sessionSettings.seed_choking_algorithm = libt::session_settings::fastest_upload;
// Disk cache pool is rarely tested in libtorrent and doesn't free buffers
// Soon to be deprecated there
// More info: https://github.com/arvidn/libtorrent/issues/2251
sessionSettings.use_disk_cache_pool = false;
configure(sessionSettings);
m_nativeSession->set_settings(sessionSettings);
configureListeningInterface();
@@ -340,6 +357,10 @@ Session::Session(QObject *parent)
pack.set_int(libt::settings_pack::connection_speed, 20); // default is 10
pack.set_bool(libt::settings_pack::no_connect_privileged_ports, false);
pack.set_int(libt::settings_pack::seed_choking_algorithm, libt::settings_pack::fastest_upload);
// Disk cache pool is rarely tested in libtorrent and doesn't free buffers
// Soon to be deprecated there
// More info: https://github.com/arvidn/libtorrent/issues/2251
pack.set_bool(libt::settings_pack::use_disk_cache_pool, false);
configure(pack);
m_nativeSession = new libt::session(pack, 0);
@@ -900,6 +921,10 @@ void Session::configure(libtorrent::settings_pack &settingsPack)
{
Logger* const logger = Logger::instance();
#ifdef Q_OS_WIN
QString chosenIP;
#endif
if (m_listenInterfaceChanged) {
const ushort port = this->port();
std::pair<int, int> ports(port, port);
@@ -929,11 +954,31 @@ void Session::configure(libtorrent::settings_pack &settingsPack)
.arg(ip).arg(port)
, Log::INFO);
settingsPack.set_str(libt::settings_pack::listen_interfaces, interfacesStr);
#ifdef Q_OS_WIN
chosenIP = ip;
#endif
break;
}
}
#ifdef Q_OS_WIN
// On Vista+ versions and after Qt 5.5 QNetworkInterface::name() returns
// the interface's Luid and not the GUID.
// Libtorrent expects GUIDs for the 'outgoing_interfaces' setting.
if (!networkInterface().isEmpty()) {
QString guid = convertIfaceNameToGuid(networkInterface());
if (!guid.isEmpty()) {
settingsPack.set_str(libt::settings_pack::outgoing_interfaces, guid.toStdString());
}
else {
settingsPack.set_str(libt::settings_pack::outgoing_interfaces, chosenIP.toStdString());
LogMsg(tr("Could not get GUID of configured network interface. Binding to IP %1").arg(chosenIP)
, Log::WARNING);
}
}
#else
settingsPack.set_str(libt::settings_pack::outgoing_interfaces, networkInterface().toStdString());
#endif
m_listenInterfaceChanged = false;
}
@@ -999,8 +1044,8 @@ void Session::configure(libtorrent::settings_pack &settingsPack)
settingsPack.set_bool(libt::settings_pack::announce_to_all_trackers, announceToAll);
settingsPack.set_bool(libt::settings_pack::announce_to_all_tiers, announceToAll);
const int cacheSize = diskCacheSize();
settingsPack.set_int(libt::settings_pack::cache_size, (cacheSize > 0) ? cacheSize * 64 : -1);
const int cacheSize = (diskCacheSize() > -1) ? diskCacheSize() * 64 : -1;
settingsPack.set_int(libt::settings_pack::cache_size, cacheSize);
settingsPack.set_int(libt::settings_pack::cache_expiry, diskCacheTTL());
qDebug() << "Using a disk cache size of" << cacheSize << "MiB";
@@ -1146,8 +1191,8 @@ void Session::configure(libtorrent::session_settings &sessionSettings)
bool announceToAll = announceToAllTrackers();
sessionSettings.announce_to_all_trackers = announceToAll;
sessionSettings.announce_to_all_tiers = announceToAll;
int cacheSize = diskCacheSize();
sessionSettings.cache_size = (cacheSize > 0) ? cacheSize * 64 : -1;
const int cacheSize = (diskCacheSize() > -1) ? diskCacheSize() * 64 : -1;
sessionSettings.cache_size = cacheSize;
sessionSettings.cache_expiry = diskCacheTTL();
qDebug() << "Using a disk cache size of" << cacheSize << "MiB";
libt::session_settings::io_buffer_mode_t mode = useOSCache() ? libt::session_settings::enable_os_cache
@@ -1716,7 +1761,7 @@ bool Session::findIncompleteFiles(TorrentInfo &torrentInfo, QString &savePath) c
torrentInfo.renameFile(i, filePath + QB_EXT);
}
if ((i % 100) == 0)
qApp->processEvents();
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
}
return found;
@@ -2217,10 +2262,10 @@ QString Session::networkInterface() const
return m_networkInterface;
}
void Session::setNetworkInterface(const QString &interface)
void Session::setNetworkInterface(const QString &iface)
{
if (interface != networkInterface()) {
m_networkInterface = interface;
if (iface != networkInterface()) {
m_networkInterface = iface;
configureListeningInterface();
}
}
@@ -2413,27 +2458,27 @@ void Session::setAnnounceToAllTrackers(bool val)
}
}
uint Session::diskCacheSize() const
int Session::diskCacheSize() const
{
uint size = m_diskCacheSize;
int size = m_diskCacheSize;
// These macros may not be available on compilers other than MSVC and GCC
#if defined(__x86_64__) || defined(_M_X64)
size = qMin(size, 4096u); // 4GiB
size = qMin(size, 4096); // 4GiB
#else
// When build as 32bit binary, set the maximum at less than 2GB to prevent crashes
// allocate 1536MiB and leave 512MiB to the rest of program data in RAM
size = qMin(size, 1536u);
size = qMin(size, 1536);
#endif
return size;
}
void Session::setDiskCacheSize(uint size)
void Session::setDiskCacheSize(int size)
{
#if defined(__x86_64__) || defined(_M_X64)
size = qMin(size, 4096u); // 4GiB
size = qMin(size, 4096); // 4GiB
#else
// allocate 1536MiB and leave 512MiB to the rest of program data in RAM
size = qMin(size, 1536u);
size = qMin(size, 1536);
#endif
if (size != m_diskCacheSize) {
m_diskCacheSize = size;
@@ -3602,4 +3647,32 @@ namespace
qDebug() << Q_FUNC_INFO << " fails: " << exc.what();
}
}
#ifdef Q_OS_WIN
QString convertIfaceNameToGuid(const QString &name)
{
// Under Windows XP or on Qt version <= 5.5 'name' will be a GUID already.
QUuid uuid(name);
if (!uuid.isNull())
return uuid.toString().toUpper(); // Libtorrent expects the GUID in uppercase
using PCONVERTIFACENAMETOLUID = NETIO_STATUS (WINAPI *)(const WCHAR *, PNET_LUID);
PCONVERTIFACENAMETOLUID ConvertIfaceNameToLuid = reinterpret_cast<PCONVERTIFACENAMETOLUID>(::GetProcAddress(::GetModuleHandleW(L"Iphlpapi.dll"), "ConvertInterfaceNameToLuidW"));
if (!ConvertIfaceNameToLuid) return QString();
using PCONVERTIFACELUIDTOGUID = NETIO_STATUS (WINAPI *)(const NET_LUID *, GUID *);
PCONVERTIFACELUIDTOGUID ConvertIfaceLuidToGuid = reinterpret_cast<PCONVERTIFACELUIDTOGUID>(::GetProcAddress(::GetModuleHandleW(L"Iphlpapi.dll"), "ConvertInterfaceLuidToGuid"));
if (!ConvertIfaceLuidToGuid) return QString();
NET_LUID luid;
LONG res = ConvertIfaceNameToLuid(name.toStdWString().c_str(), &luid);
if (res == 0) {
GUID guid;
if (ConvertIfaceLuidToGuid(&luid, &guid) == 0)
return QUuid(guid).toString().toUpper();
}
return QString();
}
#endif
}

View File

@@ -279,8 +279,8 @@ namespace BitTorrent
void setIPFilterFile(QString path);
bool announceToAllTrackers() const;
void setAnnounceToAllTrackers(bool val);
uint diskCacheSize() const;
void setDiskCacheSize(uint size);
int diskCacheSize() const;
void setDiskCacheSize(int size);
uint diskCacheTTL() const;
void setDiskCacheTTL(uint ttl);
bool useOSCache() const;
@@ -508,7 +508,7 @@ namespace BitTorrent
CachedSettingValue<bool> m_isTrackerFilteringEnabled;
CachedSettingValue<QString> m_IPFilterFile;
CachedSettingValue<bool> m_announceToAllTrackers;
CachedSettingValue<uint> m_diskCacheSize;
CachedSettingValue<int> m_diskCacheSize;
CachedSettingValue<uint> m_diskCacheTTL;
CachedSettingValue<bool> m_useOSCache;
CachedSettingValue<bool> m_isAnonymousModeEnabled;

View File

@@ -190,7 +190,9 @@ void AdvancedSettings::saveAdvancedSettings()
void AdvancedSettings::updateCacheSpinSuffix(int value)
{
if (value <= 0)
if (value == 0)
spin_cache.setSuffix(tr(" (disabled)"));
else if (value < 0)
spin_cache.setSuffix(tr(" (auto)"));
else
spin_cache.setSuffix(tr(" MiB"));
@@ -251,7 +253,7 @@ void AdvancedSettings::loadAdvancedSettings()
labelLibtorrentLink.setText(QString("<a href=\"%1\">%2</a>").arg("http://www.libtorrent.org/reference.html").arg(tr("Open documentation")));
labelLibtorrentLink.setOpenExternalLinks(true);
// Disk write cache
spin_cache.setMinimum(0);
spin_cache.setMinimum(-1);
// When build as 32bit binary, set the maximum at less than 2GB to prevent crashes.
// These macros may not be available on compilers other than MSVC and GCC
#if defined(__x86_64__) || defined(_M_X64)
@@ -323,7 +325,6 @@ void AdvancedSettings::loadAdvancedSettings()
// https://github.com/qbittorrent/qBittorrent/pull/5135
if (iface.addressEntries().isEmpty()) continue;
if (iface.flags() & QNetworkInterface::IsLoopBack) continue;
combo_iface.addItem(iface.humanReadableName(), iface.name());
if (!current_iface.isEmpty() && (iface.name() == current_iface)) {
combo_iface.setCurrentIndex(i);

View File

@@ -86,7 +86,7 @@ SpeedWidget::SpeedWidget(PropertiesWidget *parent)
m_graphsMenu->addAction(tr("Tracker Download"));
m_graphsMenuActions = m_graphsMenu->actions();
m_graphsSignalMapper = new QSignalMapper();
m_graphsSignalMapper = new QSignalMapper(this);
for (int id = SpeedPlotView::UP; id < SpeedPlotView::NB_GRAPHS; ++id) {
QAction *action = m_graphsMenuActions.at(id);

View File

@@ -424,8 +424,7 @@ bool AbstractWebApplication::isCrossSiteRequest(const Http::Request &request) co
bool AbstractWebApplication::validateHostHeader(const Http::Request &request, const Http::Environment &env, const QStringList &domains) const
{
const QUrl hostHeader = QUrl::fromUserInput(
request.headers.value(Http::HEADER_X_FORWARDED_HOST, request.headers.value(Http::HEADER_HOST)));
const QUrl hostHeader = QUrl::fromUserInput(request.headers.value(Http::HEADER_HOST));
// (if present) try matching host header's port with local port
const int requestPort = hostHeader.port();

View File

@@ -4,7 +4,7 @@ PROJECT_NAME = qbittorrent
# Define version numbers here
VER_MAJOR = 3
VER_MINOR = 3
VER_BUGFIX = 15
VER_BUGFIX = 16
VER_BUILD = 0
VER_STATUS = # Should be empty for stable releases!