Expose libtorrent max_concurrent_http_announces in advanced settings

This commit is contained in:
an0n666 2020-09-03 09:24:30 +06:00
parent 1c87073990
commit 73b39a8dec
6 changed files with 51 additions and 5 deletions

View file

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