mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-16 11:58:00 +00:00
Added PocketMinecraftServer::process() limit based on #436
This commit is contained in:
@@ -553,12 +553,17 @@ class PocketMinecraftServer{
|
||||
}
|
||||
|
||||
public function process(){
|
||||
$lastLoop = 0;
|
||||
while($this->stop === false){
|
||||
$packet = $this->interface->readPacket();
|
||||
if($packet !== false){
|
||||
$this->packetHandler($packet);
|
||||
$lastLoop = 0;
|
||||
}else{
|
||||
usleep(1);
|
||||
++$lastLoop;
|
||||
if($lastLoop >= 16){
|
||||
usleep(5000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user