mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-14 02:27:09 -07:00
Add control for 'hostname resolver cache expiry interval'
Also add a few missing units in WebUI. Closes #22267. PR #22439.
This commit is contained in:
parent
8d0870c953
commit
b28c229f85
7 changed files with 55 additions and 8 deletions
|
@ -421,6 +421,8 @@ namespace BitTorrent
|
|||
virtual void setUTPRateLimited(bool limited) = 0;
|
||||
virtual MixedModeAlgorithm utpMixedMode() const = 0;
|
||||
virtual void setUtpMixedMode(MixedModeAlgorithm mode) = 0;
|
||||
virtual int hostnameCacheTTL() const = 0;
|
||||
virtual void setHostnameCacheTTL(int value) = 0;
|
||||
virtual bool isIDNSupportEnabled() const = 0;
|
||||
virtual void setIDNSupportEnabled(bool enabled) = 0;
|
||||
virtual bool multiConnectionsPerIpEnabled() const = 0;
|
||||
|
|
|
@ -460,6 +460,7 @@ SessionImpl::SessionImpl(QObject *parent)
|
|||
, m_isUTPRateLimited(BITTORRENT_SESSION_KEY(u"uTPRateLimited"_s), true)
|
||||
, m_utpMixedMode(BITTORRENT_SESSION_KEY(u"uTPMixedMode"_s), MixedModeAlgorithm::TCP
|
||||
, clampValue(MixedModeAlgorithm::TCP, MixedModeAlgorithm::Proportional))
|
||||
, m_hostnameCacheTTL(BITTORRENT_SESSION_KEY(u"HostnameCacheTTL"_s), 1200)
|
||||
, m_IDNSupportEnabled(BITTORRENT_SESSION_KEY(u"IDNSupportEnabled"_s), false)
|
||||
, m_multiConnectionsPerIpEnabled(BITTORRENT_SESSION_KEY(u"MultiConnectionsPerIp"_s), false)
|
||||
, m_validateHTTPSTrackerCertificate(BITTORRENT_SESSION_KEY(u"ValidateHTTPSTrackerCertificate"_s), true)
|
||||
|
@ -2072,6 +2073,8 @@ lt::settings_pack SessionImpl::loadLTSettings() const
|
|||
break;
|
||||
}
|
||||
|
||||
settingsPack.set_int(lt::settings_pack::resolver_cache_timeout, hostnameCacheTTL());
|
||||
|
||||
settingsPack.set_bool(lt::settings_pack::allow_idna, isIDNSupportEnabled());
|
||||
|
||||
settingsPack.set_bool(lt::settings_pack::allow_multiple_connections_per_ip, multiConnectionsPerIpEnabled());
|
||||
|
@ -5050,6 +5053,20 @@ void SessionImpl::setUtpMixedMode(const MixedModeAlgorithm mode)
|
|||
configureDeferred();
|
||||
}
|
||||
|
||||
int SessionImpl::hostnameCacheTTL() const
|
||||
{
|
||||
return m_hostnameCacheTTL;
|
||||
}
|
||||
|
||||
void SessionImpl::setHostnameCacheTTL(const int value)
|
||||
{
|
||||
if (value == hostnameCacheTTL())
|
||||
return;
|
||||
|
||||
m_hostnameCacheTTL = value;
|
||||
configureDeferred();
|
||||
}
|
||||
|
||||
bool SessionImpl::isIDNSupportEnabled() const
|
||||
{
|
||||
return m_IDNSupportEnabled;
|
||||
|
|
|
@ -391,6 +391,8 @@ namespace BitTorrent
|
|||
void setUTPRateLimited(bool limited) override;
|
||||
MixedModeAlgorithm utpMixedMode() const override;
|
||||
void setUtpMixedMode(MixedModeAlgorithm mode) override;
|
||||
int hostnameCacheTTL() const override;
|
||||
void setHostnameCacheTTL(int value) override;
|
||||
bool isIDNSupportEnabled() const override;
|
||||
void setIDNSupportEnabled(bool enabled) override;
|
||||
bool multiConnectionsPerIpEnabled() const override;
|
||||
|
@ -686,6 +688,7 @@ namespace BitTorrent
|
|||
CachedSettingValue<BTProtocol> m_btProtocol;
|
||||
CachedSettingValue<bool> m_isUTPRateLimited;
|
||||
CachedSettingValue<MixedModeAlgorithm> m_utpMixedMode;
|
||||
CachedSettingValue<int> m_hostnameCacheTTL;
|
||||
CachedSettingValue<bool> m_IDNSupportEnabled;
|
||||
CachedSettingValue<bool> m_multiConnectionsPerIpEnabled;
|
||||
CachedSettingValue<bool> m_validateHTTPSTrackerCertificate;
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include "base/global.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/unicodestrings.h"
|
||||
#include "gui/addnewtorrentdialog.h"
|
||||
#include "gui/desktopintegration.h"
|
||||
#include "gui/mainwindow.h"
|
||||
#include "interfaces/iguiapplication.h"
|
||||
|
@ -151,6 +150,7 @@ namespace
|
|||
UPNP_LEASE_DURATION,
|
||||
PEER_TOS,
|
||||
UTP_MIX_MODE,
|
||||
HOSTNAME_CACHE_TTL,
|
||||
IDN_SUPPORT,
|
||||
MULTI_CONNECTIONS_PER_IP,
|
||||
VALIDATE_HTTPS_TRACKER_CERTIFICATE,
|
||||
|
@ -278,6 +278,8 @@ void AdvancedSettings::saveAdvancedSettings() const
|
|||
session->setPeerToS(m_spinBoxPeerToS.value());
|
||||
// uTP-TCP mixed mode
|
||||
session->setUtpMixedMode(m_comboBoxUtpMixedMode.currentData().value<BitTorrent::MixedModeAlgorithm>());
|
||||
// Hostname resolver cache TTL
|
||||
session->setHostnameCacheTTL(m_spinBoxHostnameCacheTTL.value());
|
||||
// Support internationalized domain name (IDN)
|
||||
session->setIDNSupportEnabled(m_checkBoxIDNSupport.isChecked());
|
||||
// multiple connections per IP
|
||||
|
@ -732,6 +734,14 @@ void AdvancedSettings::loadAdvancedSettings()
|
|||
addRow(UTP_MIX_MODE, (tr("%1-TCP mixed mode algorithm", "uTP-TCP mixed mode algorithm").arg(C_UTP)
|
||||
+ u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#mixed_mode_algorithm", u"(?)"))
|
||||
, &m_comboBoxUtpMixedMode);
|
||||
// Hostname resolver cache TTL
|
||||
m_spinBoxHostnameCacheTTL.setMinimum(0);
|
||||
m_spinBoxHostnameCacheTTL.setMaximum(std::numeric_limits<int>::max());
|
||||
m_spinBoxHostnameCacheTTL.setValue(session->hostnameCacheTTL());
|
||||
m_spinBoxHostnameCacheTTL.setSuffix(tr(" s", " seconds"));
|
||||
addRow(HOSTNAME_CACHE_TTL, (tr("Internal hostname resolver cache expiry interval")
|
||||
+ u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#resolver_cache_timeout", u"(?)"))
|
||||
, &m_spinBoxHostnameCacheTTL);
|
||||
// Support internationalized domain name (IDN)
|
||||
m_checkBoxIDNSupport.setChecked(session->isIDNSupportEnabled());
|
||||
addRow(IDN_SUPPORT, (tr("Support internationalized domain name (IDN)")
|
||||
|
|
|
@ -70,7 +70,7 @@ private:
|
|||
|
||||
QSpinBox m_spinBoxSaveResumeDataInterval, m_spinBoxSaveStatisticsInterval, m_spinBoxTorrentFileSizeLimit, m_spinBoxBdecodeDepthLimit, m_spinBoxBdecodeTokenLimit,
|
||||
m_spinBoxAsyncIOThreads, m_spinBoxFilePoolSize, m_spinBoxCheckingMemUsage, m_spinBoxDiskQueueSize,
|
||||
m_spinBoxOutgoingPortsMin, m_spinBoxOutgoingPortsMax, m_spinBoxUPnPLeaseDuration, m_spinBoxPeerToS,
|
||||
m_spinBoxOutgoingPortsMin, m_spinBoxOutgoingPortsMax, m_spinBoxUPnPLeaseDuration, m_spinBoxPeerToS, m_spinBoxHostnameCacheTTL,
|
||||
m_spinBoxListRefresh, m_spinBoxTrackerPort, m_spinBoxSendBufferWatermark, m_spinBoxSendBufferLowWatermark,
|
||||
m_spinBoxSendBufferWatermarkFactor, m_spinBoxConnectionSpeed, m_spinBoxSocketSendBufferSize, m_spinBoxSocketReceiveBufferSize, m_spinBoxSocketBacklogSize,
|
||||
m_spinBoxAnnouncePort, m_spinBoxMaxConcurrentHTTPAnnounces, m_spinBoxStopTrackerTimeout, m_spinBoxSessionShutdownTimeout,
|
||||
|
|
|
@ -455,6 +455,8 @@ void AppController::preferencesAction()
|
|||
data[u"peer_tos"_s] = session->peerToS();
|
||||
// uTP-TCP mixed mode
|
||||
data[u"utp_tcp_mixed_mode"_s] = static_cast<int>(session->utpMixedMode());
|
||||
// Hostname resolver cache TTL
|
||||
data[u"hostname_cache_ttl"_s] = session->hostnameCacheTTL();
|
||||
// Support internationalized domain name (IDN)
|
||||
data[u"idn_support_enabled"_s] = session->isIDNSupportEnabled();
|
||||
// Multiple connections per IP
|
||||
|
@ -1114,6 +1116,9 @@ void AppController::setPreferencesAction()
|
|||
// uTP-TCP mixed mode
|
||||
if (hasKey(u"utp_tcp_mixed_mode"_s))
|
||||
session->setUtpMixedMode(static_cast<BitTorrent::MixedModeAlgorithm>(it.value().toInt()));
|
||||
// Hostname resolver cache TTL
|
||||
if (hasKey(u"hostname_cache_ttl"_s))
|
||||
session->setHostnameCacheTTL(it.value().toInt());
|
||||
// Support internationalized domain name (IDN)
|
||||
if (hasKey(u"idn_support_enabled"_s))
|
||||
session->setIDNSupportEnabled(it.value().toBool());
|
||||
|
|
|
@ -992,7 +992,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right;"><label for="webUIBanDurationInput">QBT_TR(ban for:)QBT_TR[CONTEXT=OptionsDialog]</label></td>
|
||||
<td><input type="number" id="webUIBanDurationInput" style="width: 6em;" min="1">QBT_TR(seconds)QBT_TR[CONTEXT=OptionsDialog]</td>
|
||||
<td><input type="number" id="webUIBanDurationInput" style="width: 6em;" min="1">QBT_TR(sec)QBT_TR[CONTEXT=OptionsDialog]</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -1000,7 +1000,7 @@
|
|||
<tbody>
|
||||
<tr>
|
||||
<td><label for="webUISessionTimeoutInput">QBT_TR(Session timeout:)QBT_TR[CONTEXT=OptionsDialog]</label></td>
|
||||
<td><input type="number" id="webUISessionTimeoutInput" style="width: 6em;" min="0"> QBT_TR(seconds)QBT_TR[CONTEXT=OptionsDialog]</td>
|
||||
<td><input type="number" id="webUISessionTimeoutInput" style="width: 6em;" min="0"> QBT_TR(sec)QBT_TR[CONTEXT=OptionsDialog]</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -1364,7 +1364,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
<label for="diskCacheExpiryInterval">QBT_TR(Disk cache expiry interval:)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#cache_expiry" target="_blank">(?)</a></label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="diskCacheExpiryInterval" style="width: 15em;"> QBT_TR(s)QBT_TR[CONTEXT=OptionsDialog]
|
||||
<input type="text" id="diskCacheExpiryInterval" style="width: 15em;"> QBT_TR(sec)QBT_TR[CONTEXT=OptionsDialog]
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -1512,7 +1512,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
<label for="UPnPLeaseDuration">QBT_TR(UPnP lease duration [0: permanent lease]:)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#upnp_lease_duration" target="_blank">(?)</a></label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="UPnPLeaseDuration" style="width: 15em;">
|
||||
<input type="text" id="UPnPLeaseDuration" style="width: 15em;"> QBT_TR(sec)QBT_TR[CONTEXT=OptionsDialog]
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -1534,6 +1534,14 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="hostnameCacheTTL">QBT_TR(Internal hostname resolver cache expiry interval)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#resolver_cache_timeout" target="_blank">(?)</a></label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="hostnameCacheTTL" style="width: 15em;"> QBT_TR(sec)QBT_TR[CONTEXT=OptionsDialog]
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="IDNSupportCheckbox">QBT_TR(Support internationalized domain name (IDN):)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#allow_idna" target="_blank">(?)</a></label>
|
||||
|
@ -1642,7 +1650,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
<label for="stopTrackerTimeout">QBT_TR(Stop tracker timeout [0: disabled]:)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#stop_tracker_timeout" target="_blank">(?)</a></label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="stopTrackerTimeout" style="width: 15em;">
|
||||
<input type="text" id="stopTrackerTimeout" style="width: 15em;"> QBT_TR(sec)QBT_TR[CONTEXT=OptionsDialog]
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -1666,7 +1674,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
<label for="peerTurnoverInterval">QBT_TR(Peer turnover disconnect interval:)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#peer_turnover" target="_blank">(?)</a></label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="peerTurnoverInterval" style="width: 15em;"> s
|
||||
<input type="text" id="peerTurnoverInterval" style="width: 15em;"> QBT_TR(sec)QBT_TR[CONTEXT=OptionsDialog]
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -2594,6 +2602,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
$("UPnPLeaseDuration").value = pref.upnp_lease_duration;
|
||||
$("peerToS").value = pref.peer_tos;
|
||||
$("utpTCPMixedModeAlgorithm").value = pref.utp_tcp_mixed_mode;
|
||||
$("hostnameCacheTTL").value = pref.hostname_cache_ttl;
|
||||
$("IDNSupportCheckbox").checked = pref.idn_support_enabled;
|
||||
$("allowMultipleConnectionsFromTheSameIPAddress").checked = pref.enable_multi_connections_from_same_ip;
|
||||
$("validateHTTPSTrackerCertificate").checked = pref.validate_https_tracker_certificate;
|
||||
|
@ -3070,6 +3079,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
settings["upnp_lease_duration"] = Number($("UPnPLeaseDuration").value);
|
||||
settings["peer_tos"] = Number($("peerToS").value);
|
||||
settings["utp_tcp_mixed_mode"] = Number($("utpTCPMixedModeAlgorithm").value);
|
||||
settings["hostname_cache_ttl"] = Number($("hostnameCacheTTL").value);
|
||||
settings["idn_support_enabled"] = $("IDNSupportCheckbox").checked;
|
||||
settings["enable_multi_connections_from_same_ip"] = $("allowMultipleConnectionsFromTheSameIPAddress").checked;
|
||||
settings["validate_https_tracker_certificate"] = $("validateHTTPSTrackerCertificate").checked;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue