mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-18 12:04:46 +00:00
Properly handle Query packet errors
This commit is contained in:
@@ -2118,16 +2118,8 @@ class Server{
|
||||
* TODO: move this to Network
|
||||
*/
|
||||
public function handlePacket(AdvancedNetworkInterface $interface, string $address, int $port, string $payload){
|
||||
try{
|
||||
if(strlen($payload) > 2 and substr($payload, 0, 2) === "\xfe\xfd" and $this->queryHandler instanceof QueryHandler){
|
||||
$this->queryHandler->handle($interface, $address, $port, $payload);
|
||||
}else{
|
||||
$this->logger->debug("Unhandled raw packet from $address $port: " . bin2hex($payload));
|
||||
}
|
||||
}catch(\Throwable $e){
|
||||
$this->logger->logException($e);
|
||||
|
||||
$this->getNetwork()->blockAddress($address, 600);
|
||||
if($this->queryHandler === null or !$this->queryHandler->handle($interface, $address, $port, $payload)){
|
||||
$this->logger->debug("Unhandled raw packet from $address $port: " . bin2hex($payload));
|
||||
}
|
||||
//TODO: add raw packet events
|
||||
}
|
||||
|
Reference in New Issue
Block a user