mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 13:18:06 -06:00
Merge pull request #14976 from Chocobo1/options
Add `connection_speed` to advanced settings
This commit is contained in:
@@ -386,7 +386,7 @@ void BitTorrent::DBResumeDataStorage::createDB() const
|
||||
if (!db.commit())
|
||||
throw RuntimeError(db.lastError().text());
|
||||
}
|
||||
catch (const RuntimeError &err)
|
||||
catch (const RuntimeError &)
|
||||
{
|
||||
db.rollback();
|
||||
throw;
|
||||
@@ -563,7 +563,7 @@ void BitTorrent::DBResumeDataStorage::Worker::storeQueue(const QVector<TorrentID
|
||||
if (!db.commit())
|
||||
throw RuntimeError(db.lastError().text());
|
||||
}
|
||||
catch (const RuntimeError &err)
|
||||
catch (const RuntimeError &)
|
||||
{
|
||||
db.rollback();
|
||||
throw;
|
||||
|
||||
@@ -354,6 +354,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)
|
||||
@@ -1073,7 +1074,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);
|
||||
@@ -1190,6 +1190,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());
|
||||
@@ -3330,6 +3332,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;
|
||||
|
||||
@@ -372,6 +372,8 @@ namespace BitTorrent
|
||||
void setSendBufferLowWatermark(int value);
|
||||
int sendBufferWatermarkFactor() const;
|
||||
void setSendBufferWatermarkFactor(int value);
|
||||
int connectionSpeed() const;
|
||||
void setConnectionSpeed(int value);
|
||||
int socketBacklogSize() const;
|
||||
void setSocketBacklogSize(int value);
|
||||
bool isAnonymousModeEnabled() const;
|
||||
@@ -675,6 +677,7 @@ namespace BitTorrent
|
||||
CachedSettingValue<int> m_sendBufferWatermark;
|
||||
CachedSettingValue<int> m_sendBufferLowWatermark;
|
||||
CachedSettingValue<int> m_sendBufferWatermarkFactor;
|
||||
CachedSettingValue<int> m_connectionSpeed;
|
||||
CachedSettingValue<int> m_socketBacklogSize;
|
||||
CachedSettingValue<bool> m_isAnonymousModeEnabled;
|
||||
CachedSettingValue<bool> m_isQueueingEnabled;
|
||||
|
||||
@@ -35,43 +35,43 @@
|
||||
|
||||
namespace Http
|
||||
{
|
||||
const char METHOD_GET[] = "GET";
|
||||
const char METHOD_POST[] = "POST";
|
||||
inline const char METHOD_GET[] = "GET";
|
||||
inline const char METHOD_POST[] = "POST";
|
||||
|
||||
const char HEADER_CACHE_CONTROL[] = "cache-control";
|
||||
const char HEADER_CONNECTION[] = "connection";
|
||||
const char HEADER_CONTENT_DISPOSITION[] = "content-disposition";
|
||||
const char HEADER_CONTENT_ENCODING[] = "content-encoding";
|
||||
const char HEADER_CONTENT_LENGTH[] = "content-length";
|
||||
const char HEADER_CONTENT_SECURITY_POLICY[] = "content-security-policy";
|
||||
const char HEADER_CONTENT_TYPE[] = "content-type";
|
||||
const char HEADER_DATE[] = "date";
|
||||
const char HEADER_HOST[] = "host";
|
||||
const char HEADER_ORIGIN[] = "origin";
|
||||
const char HEADER_REFERER[] = "referer";
|
||||
const char HEADER_REFERRER_POLICY[] = "referrer-policy";
|
||||
const char HEADER_SET_COOKIE[] = "set-cookie";
|
||||
const char HEADER_X_CONTENT_TYPE_OPTIONS[] = "x-content-type-options";
|
||||
const char HEADER_X_FORWARDED_HOST[] = "x-forwarded-host";
|
||||
const char HEADER_X_FRAME_OPTIONS[] = "x-frame-options";
|
||||
const char HEADER_X_XSS_PROTECTION[] = "x-xss-protection";
|
||||
inline const char HEADER_CACHE_CONTROL[] = "cache-control";
|
||||
inline const char HEADER_CONNECTION[] = "connection";
|
||||
inline const char HEADER_CONTENT_DISPOSITION[] = "content-disposition";
|
||||
inline const char HEADER_CONTENT_ENCODING[] = "content-encoding";
|
||||
inline const char HEADER_CONTENT_LENGTH[] = "content-length";
|
||||
inline const char HEADER_CONTENT_SECURITY_POLICY[] = "content-security-policy";
|
||||
inline const char HEADER_CONTENT_TYPE[] = "content-type";
|
||||
inline const char HEADER_DATE[] = "date";
|
||||
inline const char HEADER_HOST[] = "host";
|
||||
inline const char HEADER_ORIGIN[] = "origin";
|
||||
inline const char HEADER_REFERER[] = "referer";
|
||||
inline const char HEADER_REFERRER_POLICY[] = "referrer-policy";
|
||||
inline const char HEADER_SET_COOKIE[] = "set-cookie";
|
||||
inline const char HEADER_X_CONTENT_TYPE_OPTIONS[] = "x-content-type-options";
|
||||
inline const char HEADER_X_FORWARDED_HOST[] = "x-forwarded-host";
|
||||
inline const char HEADER_X_FRAME_OPTIONS[] = "x-frame-options";
|
||||
inline const char HEADER_X_XSS_PROTECTION[] = "x-xss-protection";
|
||||
|
||||
const char HEADER_REQUEST_METHOD_GET[] = "GET";
|
||||
const char HEADER_REQUEST_METHOD_HEAD[] = "HEAD";
|
||||
const char HEADER_REQUEST_METHOD_POST[] = "POST";
|
||||
inline const char HEADER_REQUEST_METHOD_GET[] = "GET";
|
||||
inline const char HEADER_REQUEST_METHOD_HEAD[] = "HEAD";
|
||||
inline const char HEADER_REQUEST_METHOD_POST[] = "POST";
|
||||
|
||||
const char CONTENT_TYPE_HTML[] = "text/html";
|
||||
const char CONTENT_TYPE_CSS[] = "text/css";
|
||||
const char CONTENT_TYPE_TXT[] = "text/plain; charset=UTF-8";
|
||||
const char CONTENT_TYPE_JS[] = "application/javascript";
|
||||
const char CONTENT_TYPE_JSON[] = "application/json";
|
||||
const char CONTENT_TYPE_GIF[] = "image/gif";
|
||||
const char CONTENT_TYPE_PNG[] = "image/png";
|
||||
const char CONTENT_TYPE_FORM_ENCODED[] = "application/x-www-form-urlencoded";
|
||||
const char CONTENT_TYPE_FORM_DATA[] = "multipart/form-data";
|
||||
inline const char CONTENT_TYPE_HTML[] = "text/html";
|
||||
inline const char CONTENT_TYPE_CSS[] = "text/css";
|
||||
inline const char CONTENT_TYPE_TXT[] = "text/plain; charset=UTF-8";
|
||||
inline const char CONTENT_TYPE_JS[] = "application/javascript";
|
||||
inline const char CONTENT_TYPE_JSON[] = "application/json";
|
||||
inline const char CONTENT_TYPE_GIF[] = "image/gif";
|
||||
inline const char CONTENT_TYPE_PNG[] = "image/png";
|
||||
inline const char CONTENT_TYPE_FORM_ENCODED[] = "application/x-www-form-urlencoded";
|
||||
inline const char CONTENT_TYPE_FORM_DATA[] = "multipart/form-data";
|
||||
|
||||
// portability: "\r\n" doesn't guarantee mapping to the correct symbol
|
||||
const char CRLF[] = {0x0D, 0x0A, '\0'};
|
||||
inline const char CRLF[] = {0x0D, 0x0A, '\0'};
|
||||
|
||||
struct Environment
|
||||
{
|
||||
@@ -120,7 +120,7 @@ namespace Http
|
||||
HeaderMap headers;
|
||||
QByteArray content;
|
||||
|
||||
Response(uint code = 200, const QString &text = "OK")
|
||||
Response(uint code = 200, const QString &text = QLatin1String("OK"))
|
||||
: status {code, text}
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user