mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 10:49:10 +00:00
Improved manager
This commit is contained in:
parent
11ecaaa87f
commit
61828baa8f
@ -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;
|
||||
|
@ -308,9 +308,9 @@ interface FullChunk{
|
||||
|
||||
public function &getBlockLightArray();
|
||||
|
||||
public function toBinary();
|
||||
public function &toBinary();
|
||||
|
||||
public function toFastBinary();
|
||||
public function &toFastBinary();
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
|
@ -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(){
|
||||
|
@ -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){
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user