mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 20:49:43 +00:00
Added PocketMinecraftServer::process() limit based on #436
This commit is contained in:
parent
55cfc2895d
commit
26ce2e9e13
1 changed files with 6 additions and 1 deletions
|
|
@ -553,12 +553,17 @@ class PocketMinecraftServer{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process(){
|
public function process(){
|
||||||
|
$lastLoop = 0;
|
||||||
while($this->stop === false){
|
while($this->stop === false){
|
||||||
$packet = $this->interface->readPacket();
|
$packet = $this->interface->readPacket();
|
||||||
if($packet !== false){
|
if($packet !== false){
|
||||||
$this->packetHandler($packet);
|
$this->packetHandler($packet);
|
||||||
|
$lastLoop = 0;
|
||||||
}else{
|
}else{
|
||||||
usleep(1);
|
++$lastLoop;
|
||||||
|
if($lastLoop >= 16){
|
||||||
|
usleep(5000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue