Merge pull request #14976 from Chocobo1/options

Add `connection_speed` to advanced settings
This commit is contained in:
Chocobo1 2021-05-23 14:27:34 +08:00 committed by GitHub
commit 40f6201509
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 128 additions and 87 deletions

View file

@ -116,6 +116,7 @@ namespace
SEND_BUF_LOW_WATERMARK,
SEND_BUF_WATERMARK_FACTOR,
// networking & ports
CONNECTION_SPEED,
SOCKET_BACKLOG_SIZE,
OUTGOING_PORT_MIN,
OUTGOING_PORT_MAX,
@ -224,6 +225,8 @@ void AdvancedSettings::saveAdvancedSettings()
session->setSendBufferWatermark(m_spinBoxSendBufferWatermark.value());
session->setSendBufferLowWatermark(m_spinBoxSendBufferLowWatermark.value());
session->setSendBufferWatermarkFactor(m_spinBoxSendBufferWatermarkFactor.value());
// Outgoing connections per second
session->setConnectionSpeed(m_spinBoxConnectionSpeed.value());
// Socket listen backlog size
session->setSocketBacklogSize(m_spinBoxSocketBacklogSize.value());
// Save resume data interval
@ -528,6 +531,12 @@ void AdvancedSettings::loadAdvancedSettings()
m_spinBoxSendBufferWatermarkFactor.setValue(session->sendBufferWatermarkFactor());
addRow(SEND_BUF_WATERMARK_FACTOR, (tr("Send buffer watermark factor") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#send_buffer_watermark_factor", "(?)"))
, &m_spinBoxSendBufferWatermarkFactor);
// Outgoing connections per second
m_spinBoxConnectionSpeed.setMinimum(0);
m_spinBoxConnectionSpeed.setMaximum(std::numeric_limits<int>::max());
m_spinBoxConnectionSpeed.setValue(session->connectionSpeed());
addRow(CONNECTION_SPEED, (tr("Outgoing connections per second") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#connection_speed", "(?)"))
, &m_spinBoxConnectionSpeed);
// Socket listen backlog size
m_spinBoxSocketBacklogSize.setMinimum(1);
m_spinBoxSocketBacklogSize.setMaximum(std::numeric_limits<int>::max());