Protocol updates for 1.1.0.5

This commit is contained in:
Dylan K. Taylor
2017-04-20 13:54:55 +01:00
parent 17e4f45e97
commit 6c5ca9b256
7 changed files with 35 additions and 10 deletions

View File

@ -74,13 +74,16 @@ class BatchPacket extends DataPacket{
public function handle(NetworkSession $session) : bool{
if(strlen($this->payload) < 2){
throw new \InvalidStateException("Not enough bytes in payload, expected zlib header");
return false;
}
$str = zlib_decode($this->payload, 1024 * 1024 * 64); //Max 64MB
$len = strlen($str);
try{
$str = zlib_decode($this->payload, 1024 * 1024 * 64); //Max 64MB
}catch(\ErrorException $e){
return false;
}
if($len === 0){
if(strlen($str) === 0){
throw new \InvalidStateException("Decoded BatchPacket payload is empty");
}