mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-28 05:27:15 +03:00
Let OS assign listening port
This applies when "Use different port on startup" option is selected.
This commit is contained in:
parent
c19f8f6b5e
commit
672b44acba
1 changed files with 5 additions and 4 deletions
|
@ -375,7 +375,7 @@ Session::Session(QObject *parent)
|
||||||
, m_extraLimit(0)
|
, m_extraLimit(0)
|
||||||
, m_recentErroredTorrentsTimer(new QTimer(this))
|
, m_recentErroredTorrentsTimer(new QTimer(this))
|
||||||
{
|
{
|
||||||
if (useRandomPort() || (port() < 0))
|
if (port() < 0)
|
||||||
m_port = Utils::Random::rand(1024, 65535);
|
m_port = Utils::Random::rand(1024, 65535);
|
||||||
|
|
||||||
initResumeFolder();
|
initResumeFolder();
|
||||||
|
@ -1149,9 +1149,10 @@ void Session::configure(lt::settings_pack &settingsPack)
|
||||||
QString chosenIP;
|
QString chosenIP;
|
||||||
#endif
|
#endif
|
||||||
if (m_listenInterfaceChanged) {
|
if (m_listenInterfaceChanged) {
|
||||||
const ushort port = this->port();
|
const int port = useRandomPort() ? 0 : this->port();
|
||||||
const std::pair<int, int> ports(port, port);
|
if (port > 0) // user specified port
|
||||||
settingsPack.set_int(lt::settings_pack::max_retry_port_bind, ports.second - ports.first);
|
settingsPack.set_int(lt::settings_pack::max_retry_port_bind, 0);
|
||||||
|
|
||||||
for (QString ip : getListeningIPs()) {
|
for (QString ip : getListeningIPs()) {
|
||||||
lt::error_code ec;
|
lt::error_code ec;
|
||||||
std::string interfacesStr;
|
std::string interfacesStr;
|
||||||
|
|
Loading…
Reference in a new issue