mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 22:47:21 -06: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:
@@ -282,6 +282,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_socketBacklogSize(BITTORRENT_SESSION_KEY("SocketBacklogSize"), 30)
|
||||
, m_isAnonymousModeEnabled(BITTORRENT_SESSION_KEY("AnonymousModeEnabled"), false)
|
||||
, m_isQueueingEnabled(BITTORRENT_SESSION_KEY("QueueingSystemEnabled"), true)
|
||||
, m_maxActiveDownloads(BITTORRENT_SESSION_KEY("MaxActiveDownloads"), 3, lowerLimited(-1))
|
||||
@@ -1127,10 +1128,13 @@ void Session::initMetrics()
|
||||
|
||||
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
|
||||
QString chosenIP;
|
||||
#endif
|
||||
|
||||
if (m_listenInterfaceChanged) {
|
||||
const ushort port = this->port();
|
||||
const std::pair<int, int> ports(port, port);
|
||||
@@ -2955,6 +2959,19 @@ void Session::setSendBufferWatermarkFactor(const int value)
|
||||
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
|
||||
{
|
||||
return m_isAnonymousModeEnabled;
|
||||
|
||||
Reference in New Issue
Block a user