mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Use Console Thread for Async I/O
This commit is contained in:
parent
b3cc13d4f2
commit
302c865f4e
6 changed files with 56 additions and 64 deletions
|
|
@ -36,7 +36,6 @@ class ServerAPI extends stdClass{ //Yay! I can add anything to this class in run
|
|||
@mkdir(FILE_PATH."worlds/", 0777);
|
||||
@mkdir(FILE_PATH."plugins/", 0777);
|
||||
file_put_contents(FILE_PATH."logs/packets.log", "");
|
||||
file_put_contents(FILE_PATH."logs/console.in", "");
|
||||
if(!file_exists(FILE_PATH."logs/test.bin.log") or md5_file(FILE_PATH."logs/test.bin.log") !== TEST_MD5){
|
||||
console("[NOTICE] Executing integrity tests...");
|
||||
console("[INFO] OS: ".PHP_OS.", ".Utils::getOS());
|
||||
|
|
@ -187,6 +186,16 @@ class ServerAPI extends stdClass{ //Yay! I can add anything to this class in run
|
|||
$this->server->loadEntities();
|
||||
}
|
||||
|
||||
public function __destruct(){
|
||||
foreach($this->apiList as $ob){
|
||||
if(is_callable($ob, "__destruct")){
|
||||
$ob->__destruct();
|
||||
unset($this->apiList[$ob]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function loadProperties(){
|
||||
if(isset($this->config["memory-limit"])){
|
||||
@ini_set("memory_limit", $this->config["memory-limit"]);
|
||||
|
|
@ -276,6 +285,7 @@ class ServerAPI extends stdClass{ //Yay! I can add anything to this class in run
|
|||
public function start(){
|
||||
$this->server->start();
|
||||
unregister_tick_function(array($this->server, "tick"));
|
||||
$this->__destruct();
|
||||
unset($this->server);
|
||||
return $this->restart;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue