mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
Added MemoryManager, new memory properties, improved performance, updated RakLib, fixed misc. bugs
This commit is contained in:
@ -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){
|
||||
|
||||
}
|
||||
|
@ -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){
|
||||
|
Reference in New Issue
Block a user