Skip to content

Commit

Permalink
Move $throttleMaxSpeed to config.php
Browse files Browse the repository at this point in the history
Swizzin requires support changing this variable once they patch libtorrent. It limits the upload speed to 2gbps. Their maximum connection speed is 10gbps.
  • Loading branch information
stickz committed Jan 5, 2023
1 parent 23b31f8 commit 06222a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 3 additions & 0 deletions conf/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
// $scgi_host = "unix:///tmp/rpc.socket";

$XMLRPCMountPoint = "/RPC2"; // DO NOT DELETE THIS LINE!!! DO NOT COMMENT THIS LINE!!!

$throttleMaxSpeed = 327625*1024; // DO NOT EDIT THIS LINE!!! DO NOT COMMENT THIS LINE!!!
// Can't be greater then 327625*1024 due to limitation in libtorrent ResourceManager::set_max_upload_unchoked function.

$pathToExternals = array(
"php" => '', // Something like /usr/bin/php. If empty, will be found in PATH.
Expand Down
8 changes: 3 additions & 5 deletions plugins/throttle/throttle.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
require_once( $rootPath.'/php/cache.php');
eval(FileUtil::getPluginConf('throttle'));

@define('MAX_SPEED', 327625*1024);
// Can't be greater then 327625*1024 due to limitation in libtorrent ResourceManager::set_max_upload_unchoked function.

class rThrottle
{
public $hash = "throttle.dat";
Expand Down Expand Up @@ -127,11 +124,12 @@ public function obtain()
new rXMLRPCCommand( "get_download_rate" ) ));
if($req->run() && !$req->fault)
{
global $throttleMaxSpeed;
$req1 = new rXMLRPCRequest();
if($req->val[0]==0)
$req1->addCommand(new rXMLRPCCommand( "set_upload_rate", MAX_SPEED ));
$req1->addCommand(new rXMLRPCCommand( "set_upload_rate", $throttleMaxSpeed ));
if($req->val[1]==0)
$req1->addCommand(new rXMLRPCCommand( "set_download_rate", MAX_SPEED ));
$req1->addCommand(new rXMLRPCCommand( "set_download_rate", $throttleMaxSpeed ));
if((($req->val[0]==0) || ($req->val[1]==0)) &&
(!$req1->run() || $req1->fault))
return(false);
Expand Down

0 comments on commit 06222a0

Please sign in to comment.