NetworkSession: Don't crash on failure to decode compressed batches

this could be an outdated version (pre-1.1 for example).
This commit is contained in:
Dylan K. Taylor 2018-07-23 14:38:46 +01:00
parent cc84ec8629
commit 622fe99982

View File

@ -144,7 +144,13 @@ class NetworkSession{
//TODO: decryption if enabled //TODO: decryption if enabled
$stream = new PacketStream(NetworkCompression::decompress($payload)); try{
$stream = new PacketStream(NetworkCompression::decompress($payload));
}catch(\ErrorException $e){
$this->server->getLogger()->debug("Failed to decompress packet from " . $this->ip . " " . $this->port . ": " . bin2hex($payload));
$this->disconnect("Compressed packet batch decode error (incompatible game version?)", false);
return;
}
while(!$stream->feof() and $this->connected){ while(!$stream->feof() and $this->connected){
$this->handleDataPacket(PacketPool::getPacket($stream->getString())); $this->handleDataPacket(PacketPool::getPacket($stream->getString()));
} }