Limited player upload peak using CLI max-chunks-per-second parameter

This commit is contained in:
Shoghi Cervantes 2013-06-10 01:20:28 +02:00
parent affd67debe
commit ee7c767c16
2 changed files with 3 additions and 2 deletions

View File

@ -155,7 +155,7 @@ class Player{
foreach($this->chunkCount as $i => $count){ foreach($this->chunkCount as $i => $count){
if(isset($this->recoveryQueue[$count])){ if(isset($this->recoveryQueue[$count])){
$this->server->schedule(1, array($this, "getNextChunk")); $this->server->schedule(MAX_CHUNK_RATE, array($this, "getNextChunk"));
return; return;
}else{ }else{
unset($this->chunkCount[$i]); 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(){ public function save(){

View File

@ -37,6 +37,7 @@ define("VIEWER", 3);
//Players //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_MAX_RECOVERY_BUFFER", 1024);
define("PLAYER_SURVIVAL_SLOTS", 36); define("PLAYER_SURVIVAL_SLOTS", 36);