Browse Source

Remove redundant variable

adaptive-webui-19844
Chocobo1 5 years ago
parent
commit
a6c5a90630
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 63
      src/base/bittorrent/session.cpp
  2. 1
      src/base/bittorrent/session.h

63
src/base/bittorrent/session.cpp

@ -362,7 +362,6 @@ Session::Session(QObject *parent) @@ -362,7 +362,6 @@ Session::Session(QObject *parent)
, m_wasPexEnabled(m_isPeXEnabled)
, m_numResumeData(0)
, m_extraLimit(0)
, m_useProxy(false)
, m_recentErroredTorrentsTimer(new QTimer(this))
{
Logger *const logger = Logger::instance();
@ -1211,42 +1210,44 @@ void Session::configure(lt::settings_pack &settingsPack) @@ -1211,42 +1210,44 @@ void Session::configure(lt::settings_pack &settingsPack)
settingsPack.set_int(lt::settings_pack::in_enc_policy, lt::settings_pack::pe_disabled);
}
// proxy
const auto proxyManager = Net::ProxyConfigurationManager::instance();
const Net::ProxyConfiguration proxyConfig = proxyManager->proxyConfiguration();
if (m_useProxy || (proxyConfig.type != Net::ProxyType::None)) {
if (proxyConfig.type != Net::ProxyType::None) {
settingsPack.set_str(lt::settings_pack::proxy_hostname, proxyConfig.ip.toStdString());
settingsPack.set_int(lt::settings_pack::proxy_port, proxyConfig.port);
if (proxyManager->isAuthenticationRequired()) {
settingsPack.set_str(lt::settings_pack::proxy_username, proxyConfig.username.toStdString());
settingsPack.set_str(lt::settings_pack::proxy_password, proxyConfig.password.toStdString());
}
settingsPack.set_bool(lt::settings_pack::proxy_peer_connections, isProxyPeerConnectionsEnabled());
}
switch (proxyConfig.type) {
case Net::ProxyType::HTTP:
settingsPack.set_int(lt::settings_pack::proxy_type, lt::settings_pack::http);
break;
case Net::ProxyType::HTTP_PW:
settingsPack.set_int(lt::settings_pack::proxy_type, lt::settings_pack::http_pw);
break;
case Net::ProxyType::SOCKS4:
settingsPack.set_int(lt::settings_pack::proxy_type, lt::settings_pack::socks4);
break;
case Net::ProxyType::SOCKS5:
settingsPack.set_int(lt::settings_pack::proxy_type, lt::settings_pack::socks5);
break;
case Net::ProxyType::SOCKS5_PW:
settingsPack.set_int(lt::settings_pack::proxy_type, lt::settings_pack::socks5_pw);
break;
default:
settingsPack.set_int(lt::settings_pack::proxy_type, lt::settings_pack::none);
switch (proxyConfig.type) {
case Net::ProxyType::HTTP:
settingsPack.set_int(lt::settings_pack::proxy_type, lt::settings_pack::http);
break;
case Net::ProxyType::HTTP_PW:
settingsPack.set_int(lt::settings_pack::proxy_type, lt::settings_pack::http_pw);
break;
case Net::ProxyType::SOCKS4:
settingsPack.set_int(lt::settings_pack::proxy_type, lt::settings_pack::socks4);
break;
case Net::ProxyType::SOCKS5:
settingsPack.set_int(lt::settings_pack::proxy_type, lt::settings_pack::socks5);
break;
case Net::ProxyType::SOCKS5_PW:
settingsPack.set_int(lt::settings_pack::proxy_type, lt::settings_pack::socks5_pw);
break;
case Net::ProxyType::None:
default:
settingsPack.set_int(lt::settings_pack::proxy_type, lt::settings_pack::none);
}
if (proxyConfig.type != Net::ProxyType::None) {
settingsPack.set_str(lt::settings_pack::proxy_hostname, proxyConfig.ip.toStdString());
settingsPack.set_int(lt::settings_pack::proxy_port, proxyConfig.port);
if (proxyManager->isAuthenticationRequired()) {
settingsPack.set_str(lt::settings_pack::proxy_username, proxyConfig.username.toStdString());
settingsPack.set_str(lt::settings_pack::proxy_password, proxyConfig.password.toStdString());
}
m_useProxy = (proxyConfig.type != Net::ProxyType::None);
settingsPack.set_bool(lt::settings_pack::proxy_peer_connections, isProxyPeerConnectionsEnabled());
}
settingsPack.set_bool(lt::settings_pack::force_proxy, m_useProxy ? isForceProxyEnabled() : false);
settingsPack.set_bool(lt::settings_pack::force_proxy
, ((proxyConfig.type == Net::ProxyType::None) ? false : isForceProxyEnabled()));
settingsPack.set_bool(lt::settings_pack::announce_to_all_trackers, announceToAllTrackers());
settingsPack.set_bool(lt::settings_pack::announce_to_all_tiers, announceToAllTiers());

1
src/base/bittorrent/session.h

@ -671,7 +671,6 @@ namespace BitTorrent @@ -671,7 +671,6 @@ namespace BitTorrent
QVector<BitTorrent::TrackerEntry> m_additionalTrackerList;
QString m_resumeFolderPath;
QFile m_resumeFolderLock;
bool m_useProxy;
QTimer *m_refreshTimer;
QTimer *m_seedingLimitTimer;

Loading…
Cancel
Save