Added a hack to allow dropping garbage serverbound packets sent by a buggy client

This commit is contained in:
Dylan K. Taylor
2019-06-17 14:20:29 +01:00
parent 698193622a
commit b344427a30
2 changed files with 37 additions and 0 deletions

View File

@ -48,6 +48,7 @@ use pocketmine\network\mcpe\protocol\ChunkRadiusUpdatedPacket;
use pocketmine\network\mcpe\protocol\ClientboundPacket;
use pocketmine\network\mcpe\protocol\ContainerSetDataPacket;
use pocketmine\network\mcpe\protocol\DisconnectPacket;
use pocketmine\network\mcpe\protocol\GarbageServerboundPacket;
use pocketmine\network\mcpe\protocol\InventoryContentPacket;
use pocketmine\network\mcpe\protocol\InventorySlotPacket;
use pocketmine\network\mcpe\protocol\MobArmorEquipmentPacket;
@ -313,6 +314,10 @@ class NetworkSession{
*/
public function handleDataPacket(Packet $packet) : void{
if(!($packet instanceof ServerboundPacket)){
if($packet instanceof GarbageServerboundPacket){
$this->logger->debug("Garbage serverbound " . $packet->getName() . ": " . base64_encode($packet->getBuffer()));
return;
}
throw new BadPacketException("Unexpected non-serverbound packet");
}