From c237accf821c2b3e4a4da9b3fc857c258afd56fb Mon Sep 17 00:00:00 2001 From: Thomas Piccirello Date: Sun, 21 Oct 2018 23:19:35 -0400 Subject: [PATCH] Add "Apply rate limit to peers on LAN" option --- src/webui/api/appcontroller.cpp | 3 +++ src/webui/www/private/preferences_content.html | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/webui/api/appcontroller.cpp b/src/webui/api/appcontroller.cpp index cfe75a449..c6fc38d65 100644 --- a/src/webui/api/appcontroller.cpp +++ b/src/webui/api/appcontroller.cpp @@ -164,6 +164,7 @@ void AppController::preferencesAction() data["bittorrent_protocol"] = static_cast(session->btProtocol()); data["limit_utp_rate"] = session->isUTPRateLimited(); data["limit_tcp_overhead"] = session->includeOverheadInLimits(); + data["limit_lan_peers"] = !session->ignoreLimitsOnLAN(); // Scheduling data["scheduler_enabled"] = session->isBandwidthSchedulerEnabled(); const QTime start_time = pref->getSchedulerStartTime(); @@ -411,6 +412,8 @@ void AppController::setPreferencesAction() session->setUTPRateLimited(m["limit_utp_rate"].toBool()); if (m.contains("limit_tcp_overhead")) session->setIncludeOverheadInLimits(m["limit_tcp_overhead"].toBool()); + if ((it = m.find(QLatin1String("limit_lan_peers"))) != m.constEnd()) + session->setIgnoreLimitsOnLAN(!it.value().toBool()); // Scheduling if (m.contains("scheduler_enabled")) session->setBandwidthSchedulerEnabled(m["scheduler_enabled"].toBool()); diff --git a/src/webui/www/private/preferences_content.html b/src/webui/www/private/preferences_content.html index 32d469cea..4e7296f8a 100644 --- a/src/webui/www/private/preferences_content.html +++ b/src/webui/www/private/preferences_content.html @@ -454,6 +454,10 @@ +
+ + +
@@ -1211,6 +1215,7 @@ $('enable_protocol_combobox').setProperty('value', pref.bittorrent_protocol); $('limit_utp_rate_checkbox').setProperty('checked', pref.limit_utp_rate); $('limit_tcp_overhead_checkbox').setProperty('checked', pref.limit_tcp_overhead); + $('limit_lan_peers_checkbox').setProperty('checked', pref.limit_lan_peers); // Scheduling $('limit_sheduling_checkbox').setProperty('checked', pref.scheduler_enabled); @@ -1473,6 +1478,7 @@ settings.set('bittorrent_protocol', $('enable_protocol_combobox').getProperty('value')); settings.set('limit_utp_rate', $('limit_utp_rate_checkbox').getProperty('checked')); settings.set('limit_tcp_overhead', $('limit_tcp_overhead_checkbox').getProperty('checked')); + settings.set('limit_lan_peers', $('limit_lan_peers_checkbox').getProperty('checked')); // Scheduler var scheduling_enabled = $('limit_sheduling_checkbox').getProperty('checked');