Added MemoryManager, new memory properties, improved performance, updated RakLib, fixed misc. bugs

This commit is contained in:
Shoghi Cervantes
2015-04-18 20:13:52 +02:00
parent ddc152ae0a
commit b2c25eaf36
32 changed files with 652 additions and 164 deletions

View File

@ -32,9 +32,17 @@ class CompressBatchedTask extends AsyncTask{
public $channel = 0;
public $targets = [];
public function __construct(&$data, array $targets, $level = 7, $channel = 0){
$this->data = $data;
$this->targets = $targets;
$this->level = $level;
$this->channel = $channel;
}
public function onRun(){
try{
$this->final = zlib_encode($this->data, ZLIB_ENCODING_DEFLATE, $this->level);
$this->data = null;
}catch(\Exception $e){
}

View File

@ -28,7 +28,6 @@ use pocketmine\network\protocol\UnknownPacket;
use pocketmine\Player;
use pocketmine\Server;
use pocketmine\utils\MainLogger;
use pocketmine\utils\TextFormat;
use raklib\protocol\EncapsulatedPacket;
use raklib\RakLib;
use raklib\server\RakLibServer;
@ -37,9 +36,6 @@ use raklib\server\ServerInstance;
class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
/** @var \SplFixedArray */
private $packetPool;
/** @var Server */
private $server;
@ -145,7 +141,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
public function handleEncapsulated($identifier, EncapsulatedPacket $packet, $flags){
if(isset($this->players[$identifier])){
try{
$pk = $this->getPacket($packet->buffer);
$pk = &$this->getPacket($packet->buffer);
$pk->decode();
$this->players[$identifier]->handleDataPacket($pk);
}catch(\Exception $e){
@ -250,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){