From c07c5e5abd5814fc09568825f2d2a77dc7cce99f Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Fri, 26 Apr 2024 09:35:48 +0300 Subject: [PATCH] fixed always running main thread by creating sigsegv --- src/API/ConsoleAPI.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/API/ConsoleAPI.php b/src/API/ConsoleAPI.php index 4ef83f8e..56f7fc9f 100644 --- a/src/API/ConsoleAPI.php +++ b/src/API/ConsoleAPI.php @@ -1,8 +1,8 @@ help = []; @@ -15,7 +15,7 @@ class ConsoleAPI{ public function init(){ $this->server->schedule(2, [$this, "handle"], [], true); if(!defined("NO_THREADS")){ - $this->loop = new ConsoleLoop(); + self::$loop = new ConsoleLoop(); } $this->register("help", "[page|command name]", [$this, "defaultCommands"]); $this->register("status", "", [$this, "defaultCommands"]); @@ -51,8 +51,8 @@ class ConsoleAPI{ function __destruct(){ $this->server->deleteEvent($this->event); if(!defined("NO_THREADS")){ - $this->loop->stop(); - $this->loop->notify(); + self::$loop->stop(); + self::$loop->notify(); //@fclose($this->loop->fp); usleep(50000); //$this->loop->join(); @@ -68,10 +68,10 @@ class ConsoleAPI{ if(defined("NO_THREADS")){ return; } - $line = $this->loop->line; + $line = self::$loop->line; if($line !== false){ $line = preg_replace("#\\x1b\\x5b([^\\x1b]*\\x7e|[\\x40-\\x50])#", "", trim($line)); - $this->loop->line = false; + self::$loop->line = false; $output = $this->run($line, "console"); if($output != ""){ $mes = explode("\n", trim($output)); @@ -80,7 +80,7 @@ class ConsoleAPI{ } } }else{ - $this->loop->notify(); + self::$loop->notify(); } } @@ -218,7 +218,7 @@ class ConsoleAPI{ } return "TPS: " . $info["tps"] . ", Memory usage: " . $info["memory_usage"] . " (Peak " . $info["memory_peak_usage"] . ")"; case "stop": - $this->loop->stop = true; + self::$loop->stop = true; $output .= "Stopping the server\n"; $this->server->close(); break;