Add connection_speed to advanced settings

Now we follow libtorrent current default value 30.
Closes #6973.

Also bump WebAPI version.
This commit is contained in:
Chocobo1 2021-05-17 01:16:38 +08:00
parent ea3b897d5d
commit ef79546508
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
8 changed files with 47 additions and 6 deletions

View file

@ -352,6 +352,7 @@ Session::Session(QObject *parent)
, m_sendBufferWatermark(BITTORRENT_SESSION_KEY("SendBufferWatermark"), 500)
, m_sendBufferLowWatermark(BITTORRENT_SESSION_KEY("SendBufferLowWatermark"), 10)
, m_sendBufferWatermarkFactor(BITTORRENT_SESSION_KEY("SendBufferWatermarkFactor"), 50)
, m_connectionSpeed(BITTORRENT_SESSION_KEY("ConnectionSpeed"), 30)
, m_socketBacklogSize(BITTORRENT_SESSION_KEY("SocketBacklogSize"), 30)
, m_isAnonymousModeEnabled(BITTORRENT_SESSION_KEY("AnonymousModeEnabled"), false)
, m_isQueueingEnabled(BITTORRENT_SESSION_KEY("QueueingSystemEnabled"), false)
@ -1070,7 +1071,6 @@ void Session::initializeNativeSession()
// Speed up exit
pack.set_int(lt::settings_pack::auto_scrape_interval, 1200); // 20 minutes
pack.set_int(lt::settings_pack::auto_scrape_min_interval, 900); // 15 minutes
pack.set_int(lt::settings_pack::connection_speed, 20); // default is 10
// libtorrent 1.1 enables UPnP & NAT-PMP by default
// turn them off before `lt::session` ctor to avoid split second effects
pack.set_bool(lt::settings_pack::enable_upnp, false);
@ -1187,6 +1187,8 @@ void Session::initMetrics()
void Session::loadLTSettings(lt::settings_pack &settingsPack)
{
settingsPack.set_int(lt::settings_pack::connection_speed, connectionSpeed());
// from libtorrent doc:
// It will not take affect until the listen_interfaces settings is updated
settingsPack.set_int(lt::settings_pack::listen_queue_size, socketBacklogSize());
@ -3324,6 +3326,19 @@ void Session::setSendBufferWatermarkFactor(const int value)
configureDeferred();
}
int Session::connectionSpeed() const
{
return m_connectionSpeed;
}
void Session::setConnectionSpeed(const int value)
{
if (value == m_connectionSpeed) return;
m_connectionSpeed = value;
configureDeferred();
}
int Session::socketBacklogSize() const
{
return m_socketBacklogSize;