Skip to content

Commit 06222a0

Browse files
committed
Move $throttleMaxSpeed to config.php
Swizzin requires support changing this variable once they patch libtorrent. It limits the upload speed to 2gbps. Their maximum connection speed is 10gbps.
1 parent 23b31f8 commit 06222a0

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

conf/config.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
// $scgi_host = "unix:///tmp/rpc.socket";
4848

4949
$XMLRPCMountPoint = "/RPC2"; // DO NOT DELETE THIS LINE!!! DO NOT COMMENT THIS LINE!!!
50+
51+
$throttleMaxSpeed = 327625*1024; // DO NOT EDIT THIS LINE!!! DO NOT COMMENT THIS LINE!!!
52+
// Can't be greater then 327625*1024 due to limitation in libtorrent ResourceManager::set_max_upload_unchoked function.
5053

5154
$pathToExternals = array(
5255
"php" => '', // Something like /usr/bin/php. If empty, will be found in PATH.

plugins/throttle/throttle.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
require_once( $rootPath.'/php/cache.php');
44
eval(FileUtil::getPluginConf('throttle'));
55

6-
@define('MAX_SPEED', 327625*1024);
7-
// Can't be greater then 327625*1024 due to limitation in libtorrent ResourceManager::set_max_upload_unchoked function.
8-
96
class rThrottle
107
{
118
public $hash = "throttle.dat";
@@ -127,11 +124,12 @@ public function obtain()
127124
new rXMLRPCCommand( "get_download_rate" ) ));
128125
if($req->run() && !$req->fault)
129126
{
127+
global $throttleMaxSpeed;
130128
$req1 = new rXMLRPCRequest();
131129
if($req->val[0]==0)
132-
$req1->addCommand(new rXMLRPCCommand( "set_upload_rate", MAX_SPEED ));
130+
$req1->addCommand(new rXMLRPCCommand( "set_upload_rate", $throttleMaxSpeed ));
133131
if($req->val[1]==0)
134-
$req1->addCommand(new rXMLRPCCommand( "set_download_rate", MAX_SPEED ));
132+
$req1->addCommand(new rXMLRPCCommand( "set_download_rate", $throttleMaxSpeed ));
135133
if((($req->val[0]==0) || ($req->val[1]==0)) &&
136134
(!$req1->run() || $req1->fault))
137135
return(false);

0 commit comments

Comments
 (0)