mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Remove built-in pcntl support
This is a bolt-on feature that can't be disabled and causes serious grief for Unix server users, because it prevents ctrl+c aborting the server the normal way. Instead, we prefer introducing a plugin to implement this functionality, so that users can opt-in or opt-out.
This commit is contained in:
parent
390501ec35
commit
8bc33a849a
@ -121,7 +121,6 @@ use function file_exists;
|
||||
use function file_get_contents;
|
||||
use function file_put_contents;
|
||||
use function filemtime;
|
||||
use function function_exists;
|
||||
use function gc_collect_cycles;
|
||||
use function get_class;
|
||||
use function getmypid;
|
||||
@ -137,8 +136,6 @@ use function max;
|
||||
use function microtime;
|
||||
use function min;
|
||||
use function mkdir;
|
||||
use function pcntl_signal;
|
||||
use function pcntl_signal_dispatch;
|
||||
use function preg_replace;
|
||||
use function random_bytes;
|
||||
use function realpath;
|
||||
@ -162,9 +159,6 @@ use const DIRECTORY_SEPARATOR;
|
||||
use const PHP_EOL;
|
||||
use const PHP_INT_MAX;
|
||||
use const PTHREADS_INHERIT_NONE;
|
||||
use const SIGHUP;
|
||||
use const SIGINT;
|
||||
use const SIGTERM;
|
||||
|
||||
/**
|
||||
* The class that manages everything
|
||||
@ -232,9 +226,6 @@ class Server{
|
||||
/** @var int */
|
||||
private $sendUsageTicker = 0;
|
||||
|
||||
/** @var bool */
|
||||
private $dispatchSignals = false;
|
||||
|
||||
/** @var \AttachableThreadedLogger */
|
||||
private $logger;
|
||||
|
||||
@ -1850,13 +1841,6 @@ class Server{
|
||||
|
||||
$this->tickCounter = 0;
|
||||
|
||||
if(function_exists("pcntl_signal")){
|
||||
pcntl_signal(SIGTERM, [$this, "handleSignal"]);
|
||||
pcntl_signal(SIGINT, [$this, "handleSignal"]);
|
||||
pcntl_signal(SIGHUP, [$this, "handleSignal"]);
|
||||
$this->dispatchSignals = true;
|
||||
}
|
||||
|
||||
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.defaultGameMode", [GameMode::toTranslation($this->getGamemode())]));
|
||||
|
||||
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.startFinished", [round(microtime(true) - \pocketmine\START_TIME, 3)]));
|
||||
@ -1865,12 +1849,6 @@ class Server{
|
||||
$this->forceShutdown();
|
||||
}
|
||||
|
||||
public function handleSignal($signo){
|
||||
if($signo === SIGTERM or $signo === SIGINT or $signo === SIGHUP){
|
||||
$this->shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Throwable $e
|
||||
* @param array|null $trace
|
||||
@ -2222,10 +2200,6 @@ class Server{
|
||||
}
|
||||
}
|
||||
|
||||
if($this->dispatchSignals and $this->tickCounter % 5 === 0){
|
||||
pcntl_signal_dispatch();
|
||||
}
|
||||
|
||||
$this->getMemoryManager()->check();
|
||||
|
||||
Timings::$serverTickTimer->stopTiming();
|
||||
|
Loading…
x
Reference in New Issue
Block a user