diff --git a/src/Player.php b/src/Player.php index 3d2f4a4de..e2bd9ccbd 100644 --- a/src/Player.php +++ b/src/Player.php @@ -155,7 +155,7 @@ class Player{ foreach($this->chunkCount as $i => $count){ if(isset($this->recoveryQueue[$count])){ - $this->server->schedule(1, array($this, "getNextChunk")); + $this->server->schedule(MAX_CHUNK_RATE, array($this, "getNextChunk")); return; }else{ unset($this->chunkCount[$i]); @@ -207,7 +207,7 @@ class Player{ } } - $this->server->schedule(1, array($this, "getNextChunk")); + $this->server->schedule(MAX_CHUNK_RATE, array($this, "getNextChunk")); } public function save(){ diff --git a/src/constants/GeneralConstants.php b/src/constants/GeneralConstants.php index d6d609b4e..4b7592341 100644 --- a/src/constants/GeneralConstants.php +++ b/src/constants/GeneralConstants.php @@ -37,6 +37,7 @@ define("VIEWER", 3); //Players +define("MAX_CHUNK_RATE", 20 / arg("max-chunks-per-second", 3.5)); //Default rate ~172 kB/s define("PLAYER_MAX_RECOVERY_BUFFER", 1024); define("PLAYER_SURVIVAL_SLOTS", 36);