mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 00:07:30 +00:00
RakLibInterface: log the name of the session which triggered an unhandled exception
this makes it easier to identify what sequence of events led up to the crash.
This commit is contained in:
parent
acc8ae87fb
commit
006cdaf6ea
@ -192,6 +192,7 @@ class RakLibInterface implements ServerEventListener, AdvancedNetworkInterface{
|
||||
$session = $this->sessions[$sessionId];
|
||||
$address = $session->getIp();
|
||||
$buf = substr($packet, 1);
|
||||
$name = $session->getDisplayName();
|
||||
try{
|
||||
$session->handleEncoded($buf);
|
||||
}catch(PacketHandlingException $e){
|
||||
@ -204,6 +205,10 @@ class RakLibInterface implements ServerEventListener, AdvancedNetworkInterface{
|
||||
$logger->debug(implode("\n", Utils::printableExceptionInfo($e)));
|
||||
$session->disconnect("Packet processing error (Error ID: $errorId)");
|
||||
$this->interface->blockAddress($address, 5);
|
||||
}catch(\Throwable $e){
|
||||
//record the name of the player who caused the crash, to make it easier to find the reproducing steps
|
||||
$this->server->getLogger()->emergency("Crash occurred while handling a packet from session: $name");
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user