Merge branch 'release/3.5'

This commit is contained in:
Dylan K. Taylor 2019-01-01 14:08:20 +00:00
commit c6a32ccf2a
5 changed files with 5 additions and 20 deletions

View File

@ -2529,9 +2529,7 @@ class Server{
$this->logger->debug("Unhandled raw packet from $address $port: " . bin2hex($payload));
}
}catch(\Throwable $e){
if(\pocketmine\DEBUG > 1){
$this->logger->logException($e);
}
$this->logger->logException($e);
$this->getNetwork()->blockAddress($address, 600);
}

View File

@ -26,7 +26,8 @@ namespace pocketmine\event\server;
use pocketmine\network\NetworkInterface;
/**
* Called when a network interface crashes, with relevant crash information.
* Never called. Should never have come into this world. Nothing to see here.
* @deprecated
*/
class NetworkInterfaceCrashEvent extends NetworkInterfaceEvent{
/**

View File

@ -26,7 +26,6 @@ declare(strict_types=1);
*/
namespace pocketmine\network;
use pocketmine\event\server\NetworkInterfaceCrashEvent;
use pocketmine\event\server\NetworkInterfaceRegisterEvent;
use pocketmine\event\server\NetworkInterfaceUnregisterEvent;
use pocketmine\network\mcpe\NetworkSession;
@ -86,20 +85,7 @@ class Network{
public function tick() : void{
foreach($this->interfaces as $interface){
try{
$interface->tick();
}catch(\Exception $e){
$logger = $this->server->getLogger();
if(\pocketmine\DEBUG > 1){
$logger->logException($e);
}
(new NetworkInterfaceCrashEvent($interface, $e))->call();
$interface->emergencyShutdown();
$this->unregisterInterface($interface);
$logger->critical($this->server->getLanguage()->translateString("pocketmine.server.networkError", [get_class($interface), $e->getMessage()]));
}
$interface->tick();
}
foreach($this->updateSessions as $k => $session){

View File

@ -71,6 +71,7 @@ interface NetworkInterface{
public function shutdown() : void;
/**
* @deprecated
* Shuts down the network interface in an emergency situation, such as due to a crash.
*/
public function emergencyShutdown() : void;

View File

@ -84,7 +84,6 @@ class RakLibInterface implements ServerInstance, AdvancedNetworkInterface{
public function start() : void{
$this->server->getTickSleeper()->addNotifier($this->sleeper, function() : void{
//this should not throw any exception. If it does, this should crash the server since it's a fault condition.
while($this->interface->handlePacket());
});
$this->rakLib->start(PTHREADS_INHERIT_CONSTANTS); //HACK: MainLogger needs constants for exception logging