Improved manager

This commit is contained in:
Shoghi Cervantes 2015-04-18 22:33:50 +02:00
parent 11ecaaa87f
commit 61828baa8f
No known key found for this signature in database
GPG Key ID: 78464DB0A7837F89
5 changed files with 12 additions and 12 deletions

View File

@ -116,21 +116,21 @@ class MemoryManager{
$memory = Utils::getMemoryUsage(true);
$trigger = false;
if($this->memoryLimit > 0 and $memory[0] > $this->memoryLimit){
$trigger = true;
$trigger = 0;
}elseif($this->globalMemoryLimit > 0 and $memory[1] > $this->globalMemoryLimit){
$trigger = true;
$trigger = 1;
}
if($trigger){
if($trigger !== false){
if($this->lowMemory and $this->continuousTrigger){
if(++$this->continuousTriggerTicker >= $this->continuousTriggerRate){
$this->continuousTriggerTicker = 0;
$this->trigger($memory, $this->memoryLimit, ++$this->continuousTriggerCount);
$this->trigger($memory[$trigger], $this->memoryLimit, ++$this->continuousTriggerCount);
}
}else{
$this->lowMemory = true;
$this->continuousTriggerCount = 0;
$this->trigger($memory, $this->memoryLimit);
$this->trigger($memory[$trigger], $this->memoryLimit);
}
}else{
$this->lowMemory = false;

View File

@ -308,9 +308,9 @@ interface FullChunk{
public function &getBlockLightArray();
public function toBinary();
public function &toBinary();
public function toFastBinary();
public function &toFastBinary();
/**
* @return boolean

View File

@ -357,8 +357,8 @@ abstract class BaseFullChunk implements FullChunk{
$this->hasChanged = (bool) $changed;
}
public static function &fromFastBinary(&$data, LevelProvider $provider = null){
static::fromBinary($data, $provider);
public static function fromFastBinary(&$data, LevelProvider $provider = null){
return static::fromBinary($data, $provider);
}
public function &toFastBinary(){

View File

@ -246,7 +246,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
return null;
}
private function &getPacket(&$buffer){
private function getPacket(&$buffer){
$pid = ord($buffer{0});
if(($data = $this->network->getPacket($pid)) === null){

View File

@ -58,7 +58,7 @@ abstract class DataPacket extends \stdClass{
}
public function setBuffer($buffer = ""){
$this->buffer = $buffer;
$this->buffer =& $buffer;
$this->offset = 0;
}
@ -66,7 +66,7 @@ abstract class DataPacket extends \stdClass{
return $this->offset;
}
public function getBuffer(){
public function &getBuffer(){
return $this->buffer;
}