mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 09:10:00 +00:00
Removed restart command due to a huge memory leak
... Caused by free'd objects looped looping around itself calling each one and become HAL
This commit is contained in:
parent
fb019a88c1
commit
c15f8cfda6
@ -48,11 +48,11 @@ class ConsoleAPI{
|
|||||||
console("[INFO] Stopping the server...");
|
console("[INFO] Stopping the server...");
|
||||||
$this->server->close();
|
$this->server->close();
|
||||||
break;
|
break;
|
||||||
case "restart":
|
/*case "restart":
|
||||||
console("[INFO] Restarting the server...");
|
console("[INFO] Restarting the server...");
|
||||||
$this->server->api->restart = true;
|
$this->server->api->restart = true;
|
||||||
$this->server->close();
|
$this->server->close();
|
||||||
break;
|
break;*/
|
||||||
case "banip":
|
case "banip":
|
||||||
$p = strtolower(array_shift($params));
|
$p = strtolower(array_shift($params));
|
||||||
switch($p){
|
switch($p){
|
||||||
@ -179,7 +179,7 @@ class ConsoleAPI{
|
|||||||
console("[INFO] /whitelist: Manages whitelisting");
|
console("[INFO] /whitelist: Manages whitelisting");
|
||||||
console("[INFO] /banip: Manages IP ban");
|
console("[INFO] /banip: Manages IP ban");
|
||||||
console("[INFO] /stop: Stops the server");
|
console("[INFO] /stop: Stops the server");
|
||||||
console("[INFO] /restart: Restarts the server");
|
//console("[INFO] /restart: Restarts the server");
|
||||||
foreach($this->help as $c => $h){
|
foreach($this->help as $c => $h){
|
||||||
console("[INFO] /$c: ".$h[0]);
|
console("[INFO] /$c: ".$h[0]);
|
||||||
}
|
}
|
||||||
|
@ -260,6 +260,8 @@ class ServerAPI extends stdClass{ //Yay! I can add anything to this class in run
|
|||||||
|
|
||||||
public function start(){
|
public function start(){
|
||||||
$this->server->start();
|
$this->server->start();
|
||||||
|
unregister_tick_function(array($this->server, "tick"));
|
||||||
|
unset($this->server);
|
||||||
return $this->restart;
|
return $this->restart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ class PocketMinecraftServer extends stdClass{
|
|||||||
public function start(){
|
public function start(){
|
||||||
declare(ticks=15);
|
declare(ticks=15);
|
||||||
register_tick_function(array($this, "tick"));
|
register_tick_function(array($this, "tick"));
|
||||||
$this->event("onTick", "tickerFunction", true);
|
$this->event("onTick", array($this, "tickerFunction"));
|
||||||
$this->event("onReceivedPacket", "packetHandler", true);
|
$this->event("onReceivedPacket", "packetHandler", true);
|
||||||
register_shutdown_function(array($this, "close"));
|
register_shutdown_function(array($this, "close"));
|
||||||
$this->loadMap();
|
$this->loadMap();
|
||||||
|
@ -26,6 +26,7 @@ the Free Software Foundation, either version 3 of the License, or
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
gc_enable();
|
||||||
error_reporting(E_ALL ^ E_NOTICE);
|
error_reporting(E_ALL ^ E_NOTICE);
|
||||||
ini_set("display_errors", 1);
|
ini_set("display_errors", 1);
|
||||||
ini_set('default_charset', 'utf-8');
|
ini_set('default_charset', 'utf-8');
|
||||||
|
@ -35,6 +35,8 @@ while(true){
|
|||||||
|
|
||||||
if($server->start() !== true){
|
if($server->start() !== true){
|
||||||
break;
|
break;
|
||||||
|
}else{
|
||||||
|
$server = null;
|
||||||
|
console("[NOTICE] The server is restarting... (".gc_collect_cycles()." cycles collected)", true, true, 0);
|
||||||
}
|
}
|
||||||
console("[NOTICE] The server is restarting...", true, true, 0);
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user