mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 08:16:16 -07:00
Add announce_port support
The `announce_port` setting permits to overwrite the port passed along to trackers as the `&port=` parameter. If left as the default, the listening port is used. This setting is only meant for very special cases where a seed's listening port differs from the effectively exposed port (e.g., through external NAT-PMP). See https://github.com/arvidn/libtorrent/pull/7771 for an example use-case. This PR adds the relevant setting alongside the existing `announce_ip` setting. PR #21692.
This commit is contained in:
parent
9c2e698514
commit
4406a3f173
7 changed files with 53 additions and 1 deletions
|
@ -445,6 +445,7 @@ SessionImpl::SessionImpl(QObject *parent)
|
|||
, m_ignoreLimitsOnLAN(BITTORRENT_SESSION_KEY(u"IgnoreLimitsOnLAN"_s), false)
|
||||
, m_includeOverheadInLimits(BITTORRENT_SESSION_KEY(u"IncludeOverheadInLimits"_s), false)
|
||||
, m_announceIP(BITTORRENT_SESSION_KEY(u"AnnounceIP"_s))
|
||||
, m_announcePort(BITTORRENT_SESSION_KEY(u"AnnouncePort"_s), 0)
|
||||
, m_maxConcurrentHTTPAnnounces(BITTORRENT_SESSION_KEY(u"MaxConcurrentHTTPAnnounces"_s), 50)
|
||||
, m_isReannounceWhenAddressChangedEnabled(BITTORRENT_SESSION_KEY(u"ReannounceWhenAddressChanged"_s), false)
|
||||
, m_stopTrackerTimeout(BITTORRENT_SESSION_KEY(u"StopTrackerTimeout"_s), 2)
|
||||
|
@ -2004,6 +2005,10 @@ lt::settings_pack SessionImpl::loadLTSettings() const
|
|||
settingsPack.set_bool(lt::settings_pack::rate_limit_ip_overhead, includeOverheadInLimits());
|
||||
// IP address to announce to trackers
|
||||
settingsPack.set_str(lt::settings_pack::announce_ip, announceIP().toStdString());
|
||||
#if LIBTORRENT_VERSION_NUM >= 20011
|
||||
// Port to announce to trackers
|
||||
settingsPack.set_int(lt::settings_pack::announce_port, announcePort());
|
||||
#endif
|
||||
// Max concurrent HTTP announces
|
||||
settingsPack.set_int(lt::settings_pack::max_concurrent_http_announces, maxConcurrentHTTPAnnounces());
|
||||
// Stop tracker timeout
|
||||
|
@ -4879,6 +4884,20 @@ void SessionImpl::setAnnounceIP(const QString &ip)
|
|||
}
|
||||
}
|
||||
|
||||
int SessionImpl::announcePort() const
|
||||
{
|
||||
return m_announcePort;
|
||||
}
|
||||
|
||||
void SessionImpl::setAnnouncePort(const int port)
|
||||
{
|
||||
if (port != m_announcePort)
|
||||
{
|
||||
m_announcePort = port;
|
||||
configureDeferred();
|
||||
}
|
||||
}
|
||||
|
||||
int SessionImpl::maxConcurrentHTTPAnnounces() const
|
||||
{
|
||||
return m_maxConcurrentHTTPAnnounces;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue