Browse Source

Merge pull request #13319 from an0n666/tracker-queue

Expose libtorrent max_concurrent_http_announces in advanced settings
adaptive-webui-19844
Mike Tzou 4 years ago committed by GitHub
parent
commit
6e971c47e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      src/base/bittorrent/session.cpp
  2. 3
      src/base/bittorrent/session.h
  3. 15
      src/gui/advancedsettings.cpp
  4. 4
      src/gui/advancedsettings.h
  5. 5
      src/webui/api/appcontroller.cpp
  6. 10
      src/webui/www/private/views/preferences.html

19
src/base/bittorrent/session.cpp

@ -353,6 +353,7 @@ Session::Session(QObject *parent)
, m_ignoreLimitsOnLAN(BITTORRENT_SESSION_KEY("IgnoreLimitsOnLAN"), false) , m_ignoreLimitsOnLAN(BITTORRENT_SESSION_KEY("IgnoreLimitsOnLAN"), false)
, m_includeOverheadInLimits(BITTORRENT_SESSION_KEY("IncludeOverheadInLimits"), false) , m_includeOverheadInLimits(BITTORRENT_SESSION_KEY("IncludeOverheadInLimits"), false)
, m_announceIP(BITTORRENT_SESSION_KEY("AnnounceIP")) , m_announceIP(BITTORRENT_SESSION_KEY("AnnounceIP"))
, m_maxConcurrentHTTPAnnounces(BITTORRENT_SESSION_KEY("MaxConcurrentHTTPAnnounces"), 50)
#if (LIBTORRENT_VERSION_NUM >= 10206) #if (LIBTORRENT_VERSION_NUM >= 10206)
, m_stopTrackerTimeout(BITTORRENT_SESSION_KEY("StopTrackerTimeout"), 5) , m_stopTrackerTimeout(BITTORRENT_SESSION_KEY("StopTrackerTimeout"), 5)
#else #else
@ -1314,6 +1315,10 @@ void Session::loadLTSettings(lt::settings_pack &settingsPack)
settingsPack.set_bool(lt::settings_pack::rate_limit_ip_overhead, includeOverheadInLimits()); settingsPack.set_bool(lt::settings_pack::rate_limit_ip_overhead, includeOverheadInLimits());
// IP address to announce to trackers // IP address to announce to trackers
settingsPack.set_str(lt::settings_pack::announce_ip, announceIP().toStdString()); settingsPack.set_str(lt::settings_pack::announce_ip, announceIP().toStdString());
#if (LIBTORRENT_VERSION_NUM >= 10207)
// Max concurrent HTTP announces
settingsPack.set_int(lt::settings_pack::max_concurrent_http_announces, maxConcurrentHTTPAnnounces());
#endif
// Stop tracker timeout // Stop tracker timeout
settingsPack.set_int(lt::settings_pack::stop_tracker_timeout, stopTrackerTimeout()); settingsPack.set_int(lt::settings_pack::stop_tracker_timeout, stopTrackerTimeout());
// * Max connections limit // * Max connections limit
@ -3412,6 +3417,20 @@ void Session::setAnnounceIP(const QString &ip)
} }
} }
int Session::maxConcurrentHTTPAnnounces() const
{
return m_maxConcurrentHTTPAnnounces;
}
void Session::setMaxConcurrentHTTPAnnounces(const int value)
{
if (value == m_maxConcurrentHTTPAnnounces)
return;
m_maxConcurrentHTTPAnnounces = value;
configureDeferred();
}
int Session::stopTrackerTimeout() const int Session::stopTrackerTimeout() const
{ {
return m_stopTrackerTimeout; return m_stopTrackerTimeout;

3
src/base/bittorrent/session.h

@ -390,6 +390,8 @@ namespace BitTorrent
void setIncludeOverheadInLimits(bool include); void setIncludeOverheadInLimits(bool include);
QString announceIP() const; QString announceIP() const;
void setAnnounceIP(const QString &ip); void setAnnounceIP(const QString &ip);
int maxConcurrentHTTPAnnounces() const;
void setMaxConcurrentHTTPAnnounces(int value);
int stopTrackerTimeout() const; int stopTrackerTimeout() const;
void setStopTrackerTimeout(int value); void setStopTrackerTimeout(int value);
int maxConnections() const; int maxConnections() const;
@ -674,6 +676,7 @@ namespace BitTorrent
CachedSettingValue<bool> m_ignoreLimitsOnLAN; CachedSettingValue<bool> m_ignoreLimitsOnLAN;
CachedSettingValue<bool> m_includeOverheadInLimits; CachedSettingValue<bool> m_includeOverheadInLimits;
CachedSettingValue<QString> m_announceIP; CachedSettingValue<QString> m_announceIP;
CachedSettingValue<int> m_maxConcurrentHTTPAnnounces;
CachedSettingValue<int> m_stopTrackerTimeout; CachedSettingValue<int> m_stopTrackerTimeout;
CachedSettingValue<int> m_maxConnections; CachedSettingValue<int> m_maxConnections;
CachedSettingValue<int> m_maxUploads; CachedSettingValue<int> m_maxUploads;

15
src/gui/advancedsettings.cpp

@ -121,6 +121,9 @@ enum AdvSettingsRows
ANNOUNCE_ALL_TRACKERS, ANNOUNCE_ALL_TRACKERS,
ANNOUNCE_ALL_TIERS, ANNOUNCE_ALL_TIERS,
ANNOUNCE_IP, ANNOUNCE_IP,
#if (LIBTORRENT_VERSION_NUM >= 10207)
MAX_CONCURRENT_HTTP_ANNOUNCES,
#endif
STOP_TRACKER_TIMEOUT, STOP_TRACKER_TIMEOUT,
PEER_TURNOVER, PEER_TURNOVER,
PEER_TURNOVER_CUTOFF, PEER_TURNOVER_CUTOFF,
@ -252,6 +255,10 @@ void AdvancedSettings::saveAdvancedSettings()
// Construct a QHostAddress to filter malformed strings // Construct a QHostAddress to filter malformed strings
const QHostAddress addr(m_lineEditAnnounceIP.text().trimmed()); const QHostAddress addr(m_lineEditAnnounceIP.text().trimmed());
session->setAnnounceIP(addr.toString()); session->setAnnounceIP(addr.toString());
#if (LIBTORRENT_VERSION_NUM >= 10207)
// Max concurrent HTTP announces
session->setMaxConcurrentHTTPAnnounces(m_spinBoxMaxConcurrentHTTPAnnounces.value());
#endif
// Stop tracker timeout // Stop tracker timeout
session->setStopTrackerTimeout(m_spinBoxStopTrackerTimeout.value()); session->setStopTrackerTimeout(m_spinBoxStopTrackerTimeout.value());
// Program notification // Program notification
@ -559,7 +566,13 @@ void AdvancedSettings::loadAdvancedSettings()
// Announce IP // Announce IP
m_lineEditAnnounceIP.setText(session->announceIP()); m_lineEditAnnounceIP.setText(session->announceIP());
addRow(ANNOUNCE_IP, tr("IP Address to report to trackers (requires restart)"), &m_lineEditAnnounceIP); addRow(ANNOUNCE_IP, tr("IP Address to report to trackers (requires restart)"), &m_lineEditAnnounceIP);
// stop tracker timeout #if (LIBTORRENT_VERSION_NUM >= 10207)
// Max concurrent HTTP announces
m_spinBoxMaxConcurrentHTTPAnnounces.setValue(session->maxConcurrentHTTPAnnounces());
addRow(MAX_CONCURRENT_HTTP_ANNOUNCES, (tr("Max concurrent HTTP announces") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#max_concurrent_http_announces", "(?)"))
, &m_spinBoxMaxConcurrentHTTPAnnounces);
#endif
// Stop tracker timeout
m_spinBoxStopTrackerTimeout.setValue(session->stopTrackerTimeout()); m_spinBoxStopTrackerTimeout.setValue(session->stopTrackerTimeout());
m_spinBoxStopTrackerTimeout.setSuffix(tr(" s", " seconds")); m_spinBoxStopTrackerTimeout.setSuffix(tr(" s", " seconds"));
addRow(STOP_TRACKER_TIMEOUT, (tr("Stop tracker timeout") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#stop_tracker_timeout", "(?)")) addRow(STOP_TRACKER_TIMEOUT, (tr("Stop tracker timeout") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#stop_tracker_timeout", "(?)"))

4
src/gui/advancedsettings.h

@ -60,8 +60,8 @@ private:
QSpinBox m_spinBoxAsyncIOThreads, m_spinBoxFilePoolSize, m_spinBoxCheckingMemUsage, m_spinBoxCache, QSpinBox m_spinBoxAsyncIOThreads, m_spinBoxFilePoolSize, m_spinBoxCheckingMemUsage, m_spinBoxCache,
m_spinBoxSaveResumeDataInterval, m_spinBoxOutgoingPortsMin, m_spinBoxOutgoingPortsMax, m_spinBoxUPnPLeaseDuration, m_spinBoxSaveResumeDataInterval, m_spinBoxOutgoingPortsMin, m_spinBoxOutgoingPortsMax, m_spinBoxUPnPLeaseDuration,
m_spinBoxListRefresh, m_spinBoxTrackerPort, m_spinBoxCacheTTL, m_spinBoxSendBufferWatermark, m_spinBoxSendBufferLowWatermark, m_spinBoxListRefresh, m_spinBoxTrackerPort, m_spinBoxCacheTTL, m_spinBoxSendBufferWatermark, m_spinBoxSendBufferLowWatermark,
m_spinBoxSendBufferWatermarkFactor, m_spinBoxSocketBacklogSize, m_spinBoxStopTrackerTimeout, m_spinBoxSavePathHistoryLength, m_spinBoxSendBufferWatermarkFactor, m_spinBoxSocketBacklogSize, m_spinBoxMaxConcurrentHTTPAnnounces, m_spinBoxStopTrackerTimeout,
m_spinBoxPeerTurnover, m_spinBoxPeerTurnoverCutoff, m_spinBoxPeerTurnoverInterval; m_spinBoxSavePathHistoryLength, m_spinBoxPeerTurnover, m_spinBoxPeerTurnoverCutoff, m_spinBoxPeerTurnoverInterval;
QCheckBox m_checkBoxOsCache, m_checkBoxRecheckCompleted, m_checkBoxResolveCountries, m_checkBoxResolveHosts, QCheckBox m_checkBoxOsCache, m_checkBoxRecheckCompleted, m_checkBoxResolveCountries, m_checkBoxResolveHosts,
m_checkBoxProgramNotifications, m_checkBoxTorrentAddedNotifications, m_checkBoxTrackerFavicon, m_checkBoxTrackerStatus, m_checkBoxProgramNotifications, m_checkBoxTorrentAddedNotifications, m_checkBoxTrackerFavicon, m_checkBoxTrackerStatus,
m_checkBoxConfirmTorrentRecheck, m_checkBoxConfirmRemoveAllTags, m_checkBoxAnnounceAllTrackers, m_checkBoxAnnounceAllTiers, m_checkBoxConfirmTorrentRecheck, m_checkBoxConfirmRemoveAllTags, m_checkBoxAnnounceAllTrackers, m_checkBoxAnnounceAllTiers,

5
src/webui/api/appcontroller.cpp

@ -320,7 +320,7 @@ void AppController::preferencesAction()
data["announce_to_all_trackers"] = session->announceToAllTrackers(); data["announce_to_all_trackers"] = session->announceToAllTrackers();
data["announce_to_all_tiers"] = session->announceToAllTiers(); data["announce_to_all_tiers"] = session->announceToAllTiers();
data["announce_ip"] = session->announceIP(); data["announce_ip"] = session->announceIP();
// Stop tracker timeout data["max_concurrent_http_announces"] = session->maxConcurrentHTTPAnnounces();
data["stop_tracker_timeout"] = session->stopTrackerTimeout(); data["stop_tracker_timeout"] = session->stopTrackerTimeout();
// Peer Turnover // Peer Turnover
data["peer_turnover"] = session->peerTurnover(); data["peer_turnover"] = session->peerTurnover();
@ -769,7 +769,8 @@ void AppController::setPreferencesAction()
const QHostAddress announceAddr {it.value().toString().trimmed()}; const QHostAddress announceAddr {it.value().toString().trimmed()};
session->setAnnounceIP(announceAddr.isNull() ? QString {} : announceAddr.toString()); session->setAnnounceIP(announceAddr.isNull() ? QString {} : announceAddr.toString());
} }
// Stop tracker timeout if (hasKey("max_concurrent_http_announces"))
session->setMaxConcurrentHTTPAnnounces(it.value().toInt());
if (hasKey("stop_tracker_timeout")) if (hasKey("stop_tracker_timeout"))
session->setStopTrackerTimeout(it.value().toInt()); session->setStopTrackerTimeout(it.value().toInt());
// Peer Turnover // Peer Turnover

10
src/webui/www/private/views/preferences.html

@ -1153,6 +1153,14 @@
<input type="text" id="announceIP" style="width: 15em;" /> <input type="text" id="announceIP" style="width: 15em;" />
</td> </td>
</tr> </tr>
<tr>
<td>
<label for="maxConcurrentHTTPAnnounces">QBT_TR(Max concurrent HTTP announces (requires libtorrent >= 1.2.7):)QBT_TR[CONTEXT=OptionsDialog]&nbsp;<a href="https://www.libtorrent.org/reference-Settings.html#max_concurrent_http_announces" target="_blank">(?)</a></label>
</td>
<td>
<input type="text" id="maxConcurrentHTTPAnnounces" style="width: 15em;" />
</td>
</tr>
<tr> <tr>
<td> <td>
<label for="stopTrackerTimeout">QBT_TR(Stop tracker timeout:)QBT_TR[CONTEXT=OptionsDialog]&nbsp;<a href="https://www.libtorrent.org/reference-Settings.html#stop_tracker_timeout" target="_blank">(?)</a></label> <label for="stopTrackerTimeout">QBT_TR(Stop tracker timeout:)QBT_TR[CONTEXT=OptionsDialog]&nbsp;<a href="https://www.libtorrent.org/reference-Settings.html#stop_tracker_timeout" target="_blank">(?)</a></label>
@ -1880,6 +1888,7 @@
$('announceAllTrackers').setProperty('checked', pref.announce_to_all_trackers); $('announceAllTrackers').setProperty('checked', pref.announce_to_all_trackers);
$('announceAllTiers').setProperty('checked', pref.announce_to_all_tiers); $('announceAllTiers').setProperty('checked', pref.announce_to_all_tiers);
$('announceIP').setProperty('value', pref.announce_ip); $('announceIP').setProperty('value', pref.announce_ip);
$('maxConcurrentHTTPAnnounces').setProperty('value', pref.max_concurrent_http_announces);
$('stopTrackerTimeout').setProperty('value', pref.stop_tracker_timeout); $('stopTrackerTimeout').setProperty('value', pref.stop_tracker_timeout);
$('peerTurnover').setProperty('value', pref.peer_turnover); $('peerTurnover').setProperty('value', pref.peer_turnover);
$('peerTurnoverCutoff').setProperty('value', pref.peer_turnover_cutoff); $('peerTurnoverCutoff').setProperty('value', pref.peer_turnover_cutoff);
@ -2264,6 +2273,7 @@
settings.set('announce_to_all_trackers', $('announceAllTrackers').getProperty('checked')); settings.set('announce_to_all_trackers', $('announceAllTrackers').getProperty('checked'));
settings.set('announce_to_all_tiers', $('announceAllTiers').getProperty('checked')); settings.set('announce_to_all_tiers', $('announceAllTiers').getProperty('checked'));
settings.set('announce_ip', $('announceIP').getProperty('value')); settings.set('announce_ip', $('announceIP').getProperty('value'));
settings.set('max_concurrent_http_announces', $('maxConcurrentHTTPAnnounces').getProperty('value'));
settings.set('stop_tracker_timeout', $('stopTrackerTimeout').getProperty('value')); settings.set('stop_tracker_timeout', $('stopTrackerTimeout').getProperty('value'));
settings.set('peer_turnover', $('peerTurnover').getProperty('value')); settings.set('peer_turnover', $('peerTurnover').getProperty('value'));
settings.set('peer_turnover_cutoff', $('peerTurnoverCutoff').getProperty('value')); settings.set('peer_turnover_cutoff', $('peerTurnoverCutoff').getProperty('value'));

Loading…
Cancel
Save