|
|
|
@ -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,18 +1210,9 @@ void Session::configure(lt::settings_pack &settingsPack)
@@ -1211,18 +1210,9 @@ 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: |
|
|
|
@ -1240,13 +1230,24 @@ void Session::configure(lt::settings_pack &settingsPack)
@@ -1240,13 +1230,24 @@ void Session::configure(lt::settings_pack &settingsPack)
|
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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::force_proxy, m_useProxy ? isForceProxyEnabled() : false); |
|
|
|
|
|
|
|
|
|
settingsPack.set_bool(lt::settings_pack::proxy_peer_connections, isProxyPeerConnectionsEnabled()); |
|
|
|
|
} |
|
|
|
|
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()); |
|
|
|
@ -1531,7 +1532,7 @@ void Session::processShareLimits()
@@ -1531,7 +1532,7 @@ void Session::processShareLimits()
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (torrent->seedingTimeLimit() != TorrentHandle::NO_SEEDING_TIME_LIMIT) { |
|
|
|
|
const int seedingTimeInMinutes = torrent->seedingTime() / 60; |
|
|
|
|
const qlonglong seedingTimeInMinutes = torrent->seedingTime() / 60; |
|
|
|
|
int seedingTimeLimit = torrent->seedingTimeLimit(); |
|
|
|
|
if (seedingTimeLimit == TorrentHandle::USE_GLOBAL_SEEDING_TIME) |
|
|
|
|
// If Global Seeding Time Limit is really set...
|
|
|
|
@ -4002,21 +4003,24 @@ void Session::handleMetadataReceivedAlert(const lt::metadata_received_alert *p)
@@ -4002,21 +4003,24 @@ void Session::handleMetadataReceivedAlert(const lt::metadata_received_alert *p)
|
|
|
|
|
|
|
|
|
|
void Session::handleFileErrorAlert(const lt::file_error_alert *p) |
|
|
|
|
{ |
|
|
|
|
qDebug() << Q_FUNC_INFO; |
|
|
|
|
// NOTE: Check this function!
|
|
|
|
|
TorrentHandle *const torrent = m_torrents.value(p->handle.info_hash()); |
|
|
|
|
if (torrent) { |
|
|
|
|
if (!torrent) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
const InfoHash hash = torrent->hash(); |
|
|
|
|
|
|
|
|
|
if (!m_recentErroredTorrents.contains(hash)) { |
|
|
|
|
m_recentErroredTorrents.insert(hash); |
|
|
|
|
|
|
|
|
|
const QString msg = QString::fromStdString(p->message()); |
|
|
|
|
LogMsg(tr("An I/O error occurred, '%1' paused. %2").arg(torrent->name(), msg)); |
|
|
|
|
LogMsg(tr("File error alert. Torrent: \"%1\". File: \"%2\". Reason: %3") |
|
|
|
|
.arg(torrent->name(), p->filename(), msg) |
|
|
|
|
, Log::WARNING); |
|
|
|
|
emit fullDiskError(torrent, msg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
m_recentErroredTorrentsTimer->start(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Session::handlePortmapWarningAlert(const lt::portmap_error_alert *p) |
|
|
|
|
{ |
|
|
|
|