Added PocketMinecraftServer::process() limit based on #436

This commit is contained in:
Shoghi Cervantes 2013-08-20 16:57:23 +02:00
parent 55cfc2895d
commit 26ce2e9e13

View File

@ -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);
}
} }
} }
} }