mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-02 09:55:55 +00:00
Add "Socket backlog size" option
The default value in libtorrent is 5 which is too small nowadays. The new default value 30 is chosen to be in line with QTcpServer::maxPendingConnections().
This commit is contained in:
parent
73cf3fb68f
commit
6286bc716c
@ -282,6 +282,7 @@ Session::Session(QObject *parent)
|
|||||||
, m_sendBufferWatermark(BITTORRENT_SESSION_KEY("SendBufferWatermark"), 500)
|
, m_sendBufferWatermark(BITTORRENT_SESSION_KEY("SendBufferWatermark"), 500)
|
||||||
, m_sendBufferLowWatermark(BITTORRENT_SESSION_KEY("SendBufferLowWatermark"), 10)
|
, m_sendBufferLowWatermark(BITTORRENT_SESSION_KEY("SendBufferLowWatermark"), 10)
|
||||||
, m_sendBufferWatermarkFactor(BITTORRENT_SESSION_KEY("SendBufferWatermarkFactor"), 50)
|
, m_sendBufferWatermarkFactor(BITTORRENT_SESSION_KEY("SendBufferWatermarkFactor"), 50)
|
||||||
|
, m_socketBacklogSize(BITTORRENT_SESSION_KEY("SocketBacklogSize"), 30)
|
||||||
, m_isAnonymousModeEnabled(BITTORRENT_SESSION_KEY("AnonymousModeEnabled"), false)
|
, m_isAnonymousModeEnabled(BITTORRENT_SESSION_KEY("AnonymousModeEnabled"), false)
|
||||||
, m_isQueueingEnabled(BITTORRENT_SESSION_KEY("QueueingSystemEnabled"), true)
|
, m_isQueueingEnabled(BITTORRENT_SESSION_KEY("QueueingSystemEnabled"), true)
|
||||||
, m_maxActiveDownloads(BITTORRENT_SESSION_KEY("MaxActiveDownloads"), 3, lowerLimited(-1))
|
, m_maxActiveDownloads(BITTORRENT_SESSION_KEY("MaxActiveDownloads"), 3, lowerLimited(-1))
|
||||||
@ -1127,10 +1128,13 @@ void Session::initMetrics()
|
|||||||
|
|
||||||
void Session::configure(lt::settings_pack &settingsPack)
|
void Session::configure(lt::settings_pack &settingsPack)
|
||||||
{
|
{
|
||||||
|
// 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());
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
QString chosenIP;
|
QString chosenIP;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (m_listenInterfaceChanged) {
|
if (m_listenInterfaceChanged) {
|
||||||
const ushort port = this->port();
|
const ushort port = this->port();
|
||||||
const std::pair<int, int> ports(port, port);
|
const std::pair<int, int> ports(port, port);
|
||||||
@ -2955,6 +2959,19 @@ void Session::setSendBufferWatermarkFactor(const int value)
|
|||||||
configureDeferred();
|
configureDeferred();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Session::socketBacklogSize() const
|
||||||
|
{
|
||||||
|
return m_socketBacklogSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Session::setSocketBacklogSize(const int value)
|
||||||
|
{
|
||||||
|
if (value == m_socketBacklogSize) return;
|
||||||
|
|
||||||
|
m_socketBacklogSize = value;
|
||||||
|
configureDeferred();
|
||||||
|
}
|
||||||
|
|
||||||
bool Session::isAnonymousModeEnabled() const
|
bool Session::isAnonymousModeEnabled() const
|
||||||
{
|
{
|
||||||
return m_isAnonymousModeEnabled;
|
return m_isAnonymousModeEnabled;
|
||||||
|
@ -340,6 +340,8 @@ namespace BitTorrent
|
|||||||
void setSendBufferLowWatermark(int value);
|
void setSendBufferLowWatermark(int value);
|
||||||
int sendBufferWatermarkFactor() const;
|
int sendBufferWatermarkFactor() const;
|
||||||
void setSendBufferWatermarkFactor(int value);
|
void setSendBufferWatermarkFactor(int value);
|
||||||
|
int socketBacklogSize() const;
|
||||||
|
void setSocketBacklogSize(int value);
|
||||||
bool isAnonymousModeEnabled() const;
|
bool isAnonymousModeEnabled() const;
|
||||||
void setAnonymousModeEnabled(bool enabled);
|
void setAnonymousModeEnabled(bool enabled);
|
||||||
bool isQueueingSystemEnabled() const;
|
bool isQueueingSystemEnabled() const;
|
||||||
@ -595,6 +597,7 @@ namespace BitTorrent
|
|||||||
CachedSettingValue<int> m_sendBufferWatermark;
|
CachedSettingValue<int> m_sendBufferWatermark;
|
||||||
CachedSettingValue<int> m_sendBufferLowWatermark;
|
CachedSettingValue<int> m_sendBufferLowWatermark;
|
||||||
CachedSettingValue<int> m_sendBufferWatermarkFactor;
|
CachedSettingValue<int> m_sendBufferWatermarkFactor;
|
||||||
|
CachedSettingValue<int> m_socketBacklogSize;
|
||||||
CachedSettingValue<bool> m_isAnonymousModeEnabled;
|
CachedSettingValue<bool> m_isAnonymousModeEnabled;
|
||||||
CachedSettingValue<bool> m_isQueueingEnabled;
|
CachedSettingValue<bool> m_isQueueingEnabled;
|
||||||
CachedSettingValue<int> m_maxActiveDownloads;
|
CachedSettingValue<int> m_maxActiveDownloads;
|
||||||
|
@ -100,7 +100,8 @@ enum AdvSettingsRows
|
|||||||
SEND_BUF_WATERMARK,
|
SEND_BUF_WATERMARK,
|
||||||
SEND_BUF_LOW_WATERMARK,
|
SEND_BUF_LOW_WATERMARK,
|
||||||
SEND_BUF_WATERMARK_FACTOR,
|
SEND_BUF_WATERMARK_FACTOR,
|
||||||
// ports
|
// networking & ports
|
||||||
|
SOCKET_BACKLOG_SIZE,
|
||||||
OUTGOING_PORT_MIN,
|
OUTGOING_PORT_MIN,
|
||||||
OUTGOING_PORT_MAX,
|
OUTGOING_PORT_MAX,
|
||||||
UTP_MIX_MODE,
|
UTP_MIX_MODE,
|
||||||
@ -171,6 +172,8 @@ void AdvancedSettings::saveAdvancedSettings()
|
|||||||
session->setSendBufferWatermark(spinBoxSendBufferWatermark.value());
|
session->setSendBufferWatermark(spinBoxSendBufferWatermark.value());
|
||||||
session->setSendBufferLowWatermark(spinBoxSendBufferLowWatermark.value());
|
session->setSendBufferLowWatermark(spinBoxSendBufferLowWatermark.value());
|
||||||
session->setSendBufferWatermarkFactor(spinBoxSendBufferWatermarkFactor.value());
|
session->setSendBufferWatermarkFactor(spinBoxSendBufferWatermarkFactor.value());
|
||||||
|
// Socket listen backlog size
|
||||||
|
session->setSocketBacklogSize(spinBoxSocketBacklogSize.value());
|
||||||
// Save resume data interval
|
// Save resume data interval
|
||||||
session->setSaveResumeDataInterval(spinBoxSaveResumeDataInterval.value());
|
session->setSaveResumeDataInterval(spinBoxSaveResumeDataInterval.value());
|
||||||
// Outgoing ports
|
// Outgoing ports
|
||||||
@ -394,6 +397,12 @@ void AdvancedSettings::loadAdvancedSettings()
|
|||||||
spinBoxSendBufferWatermarkFactor.setValue(session->sendBufferWatermarkFactor());
|
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", "(?)"))
|
addRow(SEND_BUF_WATERMARK_FACTOR, (tr("Send buffer watermark factor") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#send_buffer_watermark_factor", "(?)"))
|
||||||
, &spinBoxSendBufferWatermarkFactor);
|
, &spinBoxSendBufferWatermarkFactor);
|
||||||
|
// Socket listen backlog size
|
||||||
|
spinBoxSocketBacklogSize.setMinimum(1);
|
||||||
|
spinBoxSocketBacklogSize.setMaximum(std::numeric_limits<int>::max());
|
||||||
|
spinBoxSocketBacklogSize.setValue(session->socketBacklogSize());
|
||||||
|
addRow(SOCKET_BACKLOG_SIZE, (tr("Socket backlog size") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#listen_queue_size", "(?)"))
|
||||||
|
, &spinBoxSocketBacklogSize);
|
||||||
// Save resume data interval
|
// Save resume data interval
|
||||||
spinBoxSaveResumeDataInterval.setMinimum(0);
|
spinBoxSaveResumeDataInterval.setMinimum(0);
|
||||||
spinBoxSaveResumeDataInterval.setMaximum(std::numeric_limits<int>::max());
|
spinBoxSaveResumeDataInterval.setMaximum(std::numeric_limits<int>::max());
|
||||||
|
@ -61,7 +61,7 @@ private:
|
|||||||
QLabel labelQbtLink, labelLibtorrentLink;
|
QLabel labelQbtLink, labelLibtorrentLink;
|
||||||
QSpinBox spinBoxAsyncIOThreads, spinBoxCheckingMemUsage, spinBoxCache, spinBoxSaveResumeDataInterval, spinBoxOutgoingPortsMin, spinBoxOutgoingPortsMax, spinBoxListRefresh,
|
QSpinBox spinBoxAsyncIOThreads, spinBoxCheckingMemUsage, spinBoxCache, spinBoxSaveResumeDataInterval, spinBoxOutgoingPortsMin, spinBoxOutgoingPortsMax, spinBoxListRefresh,
|
||||||
spinBoxTrackerPort, spinBoxCacheTTL, spinBoxSendBufferWatermark, spinBoxSendBufferLowWatermark,
|
spinBoxTrackerPort, spinBoxCacheTTL, spinBoxSendBufferWatermark, spinBoxSendBufferLowWatermark,
|
||||||
spinBoxSendBufferWatermarkFactor, spinBoxSavePathHistoryLength;
|
spinBoxSendBufferWatermarkFactor, spinBoxSocketBacklogSize, spinBoxSavePathHistoryLength;
|
||||||
QCheckBox checkBoxOsCache, checkBoxRecheckCompleted, checkBoxResolveCountries, checkBoxResolveHosts, checkBoxSuperSeeding,
|
QCheckBox checkBoxOsCache, checkBoxRecheckCompleted, checkBoxResolveCountries, checkBoxResolveHosts, checkBoxSuperSeeding,
|
||||||
checkBoxProgramNotifications, checkBoxTorrentAddedNotifications, checkBoxTrackerFavicon, checkBoxTrackerStatus,
|
checkBoxProgramNotifications, checkBoxTorrentAddedNotifications, checkBoxTrackerFavicon, checkBoxTrackerStatus,
|
||||||
checkBoxConfirmTorrentRecheck, checkBoxConfirmRemoveAllTags, checkBoxListenIPv6, checkBoxAnnounceAllTrackers, checkBoxAnnounceAllTiers,
|
checkBoxConfirmTorrentRecheck, checkBoxConfirmRemoveAllTags, checkBoxListenIPv6, checkBoxAnnounceAllTrackers, checkBoxAnnounceAllTiers,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user