mirror of
https://github.com/qbittorrent/qBittorrent
synced 2024-11-14 19:12:46 +01:00
parent
40e28930a4
commit
77411760a0
@ -328,6 +328,10 @@ namespace BitTorrent
|
||||
virtual void setSendBufferWatermarkFactor(int value) = 0;
|
||||
virtual int connectionSpeed() const = 0;
|
||||
virtual void setConnectionSpeed(int value) = 0;
|
||||
virtual int socketSendBufferSize() const = 0;
|
||||
virtual void setSocketSendBufferSize(int value) = 0;
|
||||
virtual int socketReceiveBufferSize() const = 0;
|
||||
virtual void setSocketReceiveBufferSize(int value) = 0;
|
||||
virtual int socketBacklogSize() const = 0;
|
||||
virtual void setSocketBacklogSize(int value) = 0;
|
||||
virtual bool isAnonymousModeEnabled() const = 0;
|
||||
|
@ -436,6 +436,8 @@ SessionImpl::SessionImpl(QObject *parent)
|
||||
, m_sendBufferLowWatermark(BITTORRENT_SESSION_KEY(u"SendBufferLowWatermark"_qs), 10)
|
||||
, m_sendBufferWatermarkFactor(BITTORRENT_SESSION_KEY(u"SendBufferWatermarkFactor"_qs), 50)
|
||||
, m_connectionSpeed(BITTORRENT_SESSION_KEY(u"ConnectionSpeed"_qs), 30)
|
||||
, m_socketSendBufferSize(BITTORRENT_SESSION_KEY(u"SocketSendBufferSize"_qs), 0)
|
||||
, m_socketReceiveBufferSize(BITTORRENT_SESSION_KEY(u"SocketReceiveBufferSize"_qs), 0)
|
||||
, m_socketBacklogSize(BITTORRENT_SESSION_KEY(u"SocketBacklogSize"_qs), 30)
|
||||
, m_isAnonymousModeEnabled(BITTORRENT_SESSION_KEY(u"AnonymousModeEnabled"_qs), false)
|
||||
, m_isQueueingEnabled(BITTORRENT_SESSION_KEY(u"QueueingSystemEnabled"_qs), false)
|
||||
@ -1599,6 +1601,8 @@ lt::settings_pack SessionImpl::loadLTSettings() const
|
||||
|
||||
// from libtorrent doc:
|
||||
// It will not take affect until the listen_interfaces settings is updated
|
||||
settingsPack.set_int(lt::settings_pack::send_socket_buffer_size, socketSendBufferSize());
|
||||
settingsPack.set_int(lt::settings_pack::recv_socket_buffer_size, socketReceiveBufferSize());
|
||||
settingsPack.set_int(lt::settings_pack::listen_queue_size, socketBacklogSize());
|
||||
|
||||
applyNetworkInterfacesSettings(settingsPack);
|
||||
@ -4181,6 +4185,34 @@ void SessionImpl::setConnectionSpeed(const int value)
|
||||
configureDeferred();
|
||||
}
|
||||
|
||||
int SessionImpl::socketSendBufferSize() const
|
||||
{
|
||||
return m_socketSendBufferSize;
|
||||
}
|
||||
|
||||
void SessionImpl::setSocketSendBufferSize(const int value)
|
||||
{
|
||||
if (value == m_socketSendBufferSize)
|
||||
return;
|
||||
|
||||
m_socketSendBufferSize = value;
|
||||
configureDeferred();
|
||||
}
|
||||
|
||||
int SessionImpl::socketReceiveBufferSize() const
|
||||
{
|
||||
return m_socketReceiveBufferSize;
|
||||
}
|
||||
|
||||
void SessionImpl::setSocketReceiveBufferSize(const int value)
|
||||
{
|
||||
if (value == m_socketReceiveBufferSize)
|
||||
return;
|
||||
|
||||
m_socketReceiveBufferSize = value;
|
||||
configureDeferred();
|
||||
}
|
||||
|
||||
int SessionImpl::socketBacklogSize() const
|
||||
{
|
||||
return m_socketBacklogSize;
|
||||
|
@ -305,6 +305,10 @@ namespace BitTorrent
|
||||
void setSendBufferWatermarkFactor(int value) override;
|
||||
int connectionSpeed() const override;
|
||||
void setConnectionSpeed(int value) override;
|
||||
int socketSendBufferSize() const override;
|
||||
void setSocketSendBufferSize(int value) override;
|
||||
int socketReceiveBufferSize() const override;
|
||||
void setSocketReceiveBufferSize(int value) override;
|
||||
int socketBacklogSize() const override;
|
||||
void setSocketBacklogSize(int value) override;
|
||||
bool isAnonymousModeEnabled() const override;
|
||||
@ -601,6 +605,8 @@ namespace BitTorrent
|
||||
CachedSettingValue<int> m_sendBufferLowWatermark;
|
||||
CachedSettingValue<int> m_sendBufferWatermarkFactor;
|
||||
CachedSettingValue<int> m_connectionSpeed;
|
||||
CachedSettingValue<int> m_socketSendBufferSize;
|
||||
CachedSettingValue<int> m_socketReceiveBufferSize;
|
||||
CachedSettingValue<int> m_socketBacklogSize;
|
||||
CachedSettingValue<bool> m_isAnonymousModeEnabled;
|
||||
CachedSettingValue<bool> m_isQueueingEnabled;
|
||||
|
@ -127,6 +127,8 @@ namespace
|
||||
SEND_BUF_WATERMARK_FACTOR,
|
||||
// networking & ports
|
||||
CONNECTION_SPEED,
|
||||
SOCKET_SEND_BUFFER_SIZE,
|
||||
SOCKET_RECEIVE_BUFFER_SIZE,
|
||||
SOCKET_BACKLOG_SIZE,
|
||||
OUTGOING_PORT_MIN,
|
||||
OUTGOING_PORT_MAX,
|
||||
@ -228,6 +230,10 @@ void AdvancedSettings::saveAdvancedSettings() const
|
||||
session->setSendBufferWatermarkFactor(m_spinBoxSendBufferWatermarkFactor.value());
|
||||
// Outgoing connections per second
|
||||
session->setConnectionSpeed(m_spinBoxConnectionSpeed.value());
|
||||
// Socket send buffer size
|
||||
session->setSocketSendBufferSize(m_spinBoxSocketSendBufferSize.value());
|
||||
// Socket receive buffer size
|
||||
session->setSocketReceiveBufferSize(m_spinBoxSocketReceiveBufferSize.value());
|
||||
// Socket listen backlog size
|
||||
session->setSocketBacklogSize(m_spinBoxSocketBacklogSize.value());
|
||||
// Save resume data interval
|
||||
@ -567,6 +573,22 @@ void AdvancedSettings::loadAdvancedSettings()
|
||||
m_spinBoxConnectionSpeed.setValue(session->connectionSpeed());
|
||||
addRow(CONNECTION_SPEED, (tr("Outgoing connections per second") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#connection_speed", u"(?)"))
|
||||
, &m_spinBoxConnectionSpeed);
|
||||
// Socket send buffer size
|
||||
m_spinBoxSocketSendBufferSize.setMinimum(0);
|
||||
m_spinBoxSocketSendBufferSize.setMaximum(std::numeric_limits<int>::max());
|
||||
m_spinBoxSocketSendBufferSize.setValue(session->socketSendBufferSize());
|
||||
m_spinBoxSocketSendBufferSize.setSuffix(tr(" Bytes"));
|
||||
m_spinBoxSocketSendBufferSize.setSpecialValueText(tr("System default"));
|
||||
addRow(SOCKET_SEND_BUFFER_SIZE, (tr("Socket send buffer size") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#send_socket_buffer_size", u"(?)"))
|
||||
, &m_spinBoxSocketSendBufferSize);
|
||||
// Socket receive buffer size
|
||||
m_spinBoxSocketReceiveBufferSize.setMinimum(0);
|
||||
m_spinBoxSocketReceiveBufferSize.setMaximum(std::numeric_limits<int>::max());
|
||||
m_spinBoxSocketReceiveBufferSize.setValue(session->socketReceiveBufferSize());
|
||||
m_spinBoxSocketReceiveBufferSize.setSuffix(tr(" Bytes"));
|
||||
m_spinBoxSocketReceiveBufferSize.setSpecialValueText(tr("System default"));
|
||||
addRow(SOCKET_RECEIVE_BUFFER_SIZE, (tr("Socket receive buffer size") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#recv_socket_buffer_size", u"(?)"))
|
||||
, &m_spinBoxSocketReceiveBufferSize);
|
||||
// Socket listen backlog size
|
||||
m_spinBoxSocketBacklogSize.setMinimum(1);
|
||||
m_spinBoxSocketBacklogSize.setMaximum(std::numeric_limits<int>::max());
|
||||
|
@ -64,7 +64,8 @@ private:
|
||||
QSpinBox m_spinBoxAsyncIOThreads, m_spinBoxFilePoolSize, m_spinBoxCheckingMemUsage, m_spinBoxDiskQueueSize,
|
||||
m_spinBoxSaveResumeDataInterval, m_spinBoxOutgoingPortsMin, m_spinBoxOutgoingPortsMax, m_spinBoxUPnPLeaseDuration, m_spinBoxPeerToS,
|
||||
m_spinBoxListRefresh, m_spinBoxTrackerPort, m_spinBoxSendBufferWatermark, m_spinBoxSendBufferLowWatermark,
|
||||
m_spinBoxSendBufferWatermarkFactor, m_spinBoxConnectionSpeed, m_spinBoxSocketBacklogSize, m_spinBoxMaxConcurrentHTTPAnnounces, m_spinBoxStopTrackerTimeout,
|
||||
m_spinBoxSendBufferWatermarkFactor, m_spinBoxConnectionSpeed, m_spinBoxSocketSendBufferSize, m_spinBoxSocketReceiveBufferSize, m_spinBoxSocketBacklogSize,
|
||||
m_spinBoxMaxConcurrentHTTPAnnounces, m_spinBoxStopTrackerTimeout,
|
||||
m_spinBoxSavePathHistoryLength, m_spinBoxPeerTurnover, m_spinBoxPeerTurnoverCutoff, m_spinBoxPeerTurnoverInterval, m_spinBoxRequestQueueSize;
|
||||
QCheckBox m_checkBoxOsCache, m_checkBoxRecheckCompleted, m_checkBoxResolveCountries, m_checkBoxResolveHosts,
|
||||
m_checkBoxProgramNotifications, m_checkBoxTorrentAddedNotifications, m_checkBoxReannounceWhenAddressChanged, m_checkBoxTrackerFavicon, m_checkBoxTrackerStatus,
|
||||
|
@ -363,6 +363,10 @@ void AppController::preferencesAction()
|
||||
data[u"send_buffer_watermark_factor"_qs] = session->sendBufferWatermarkFactor();
|
||||
// Outgoing connections per second
|
||||
data[u"connection_speed"_qs] = session->connectionSpeed();
|
||||
// Socket send buffer size
|
||||
data[u"socket_send_buffer_size"_qs] = session->socketSendBufferSize();
|
||||
// Socket receive buffer size
|
||||
data[u"socket_receive_buffer_size"_qs] = session->socketReceiveBufferSize();
|
||||
// Socket listen backlog size
|
||||
data[u"socket_backlog_size"_qs] = session->socketBacklogSize();
|
||||
// Outgoing ports
|
||||
@ -908,6 +912,12 @@ void AppController::setPreferencesAction()
|
||||
// Outgoing connections per second
|
||||
if (hasKey(u"connection_speed"_qs))
|
||||
session->setConnectionSpeed(it.value().toInt());
|
||||
// Socket send buffer size
|
||||
if (hasKey(u"socket_send_buffer_size"_qs))
|
||||
session->setSocketSendBufferSize(it.value().toInt());
|
||||
// Socket receive buffer size
|
||||
if (hasKey(u"socket_receive_buffer_size"_qs))
|
||||
session->setSocketReceiveBufferSize(it.value().toInt());
|
||||
// Socket listen backlog size
|
||||
if (hasKey(u"socket_backlog_size"_qs))
|
||||
session->setSocketBacklogSize(it.value().toInt());
|
||||
|
@ -52,7 +52,7 @@
|
||||
#include "base/utils/version.h"
|
||||
#include "api/isessionmanager.h"
|
||||
|
||||
inline const Utils::Version<3, 2> API_VERSION {2, 9, 0};
|
||||
inline const Utils::Version<3, 2> API_VERSION {2, 9, 1};
|
||||
|
||||
class APIController;
|
||||
class AuthController;
|
||||
|
@ -1180,6 +1180,22 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
<input type="text" id="connectionSpeed" style="width: 15em;" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="socketSendBufferSize">QBT_TR(Socket send buffer size [0: system default]:)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#send_socket_buffer_size" target="_blank">(?)</a></label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="socketSendBufferSize" style="width: 15em;" /> QBT_TR(Bytes)QBT_TR[CONTEXT=OptionsDialog]
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="socketReceiveBufferSize">QBT_TR(Socket receive buffer size [0: system default]:)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#recv_socket_buffer_size" target="_blank">(?)</a></label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="socketReceiveBufferSize" style="width: 15em;" /> QBT_TR(Bytes)QBT_TR[CONTEXT=OptionsDialog]
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="socketBacklogSize">QBT_TR(Socket backlog size:)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#listen_queue_size" target="_blank">(?)</a></label>
|
||||
@ -2140,6 +2156,8 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
$('sendBufferLowWatermark').setProperty('value', pref.send_buffer_low_watermark);
|
||||
$('sendBufferWatermarkFactor').setProperty('value', pref.send_buffer_watermark_factor);
|
||||
$('connectionSpeed').setProperty('value', pref.connection_speed);
|
||||
$('socketSendBufferSize').setProperty('value', pref.socket_send_buffer_size);
|
||||
$('socketReceiveBufferSize').setProperty('value', pref.socket_receive_buffer_size);
|
||||
$('socketBacklogSize').setProperty('value', pref.socket_backlog_size);
|
||||
$('outgoingPortsMin').setProperty('value', pref.outgoing_ports_min);
|
||||
$('outgoingPortsMax').setProperty('value', pref.outgoing_ports_max);
|
||||
@ -2554,6 +2572,8 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
settings.set('send_buffer_low_watermark', $('sendBufferLowWatermark').getProperty('value'));
|
||||
settings.set('send_buffer_watermark_factor', $('sendBufferWatermarkFactor').getProperty('value'));
|
||||
settings.set('connection_speed', $('connectionSpeed').getProperty('value'));
|
||||
settings.set('socket_send_buffer_size', $('socketSendBufferSize').getProperty('value'));
|
||||
settings.set('socket_receive_buffer_size', $('socketReceiveBufferSize').getProperty('value'));
|
||||
settings.set('socket_backlog_size', $('socketBacklogSize').getProperty('value'));
|
||||
settings.set('outgoing_ports_min', $('outgoingPortsMin').getProperty('value'));
|
||||
settings.set('outgoing_ports_max', $('outgoingPortsMax').getProperty('value'));
|
||||
|
Loading…
Reference in New Issue
Block a user