Remove level locks, possible fix for #2046

This commit is contained in:
Shoghi Cervantes 2014-09-18 11:44:16 +02:00
parent 6fb7170556
commit 8c627bd0af
3 changed files with 1 additions and 6 deletions

View File

@ -45,7 +45,6 @@ class RegionLoader extends \pocketmine\level\format\mcregion\RegionLoader{
$this->filePath = $this->levelProvider->getPath() . "region/r.$regionX.$regionZ.mca";
touch($this->filePath);
$this->filePointer = fopen($this->filePath, "r+b");
flock($this->filePointer, LOCK_EX);
stream_set_read_buffer($this->filePointer, 1024 * 16); //16KB
stream_set_write_buffer($this->filePointer, 1024 * 16); //16KB
if(!file_exists($this->filePath)){

View File

@ -191,7 +191,7 @@ class McRegion extends BaseLevelProvider{
public function unloadChunk($x, $z, $safe = true){
$chunk = $this->getChunk($x, $z, false);
if($chunk instanceof FullChunk){
if($safe === true and $this->isChunkLoaded($x, $z)){
if($safe === true){
foreach($chunk->getEntities() as $entity){
if($entity instanceof Player){
return false;

View File

@ -55,7 +55,6 @@ class RegionLoader{
$this->filePath = $this->levelProvider->getPath() . "region/r.$regionX.$regionZ.mcr";
touch($this->filePath);
$this->filePointer = fopen($this->filePath, "r+b");
flock($this->filePointer, LOCK_EX);
stream_set_read_buffer($this->filePointer, 1024 * 16); //16KB
stream_set_write_buffer($this->filePointer, 1024 * 16); //16KB
if(!file_exists($this->filePath)){
@ -67,9 +66,7 @@ class RegionLoader{
public function __destruct(){
if(is_resource($this->filePointer)){
$this->cleanGarbage();
$this->writeLocationTable();
flock($this->filePointer, LOCK_UN);
fclose($this->filePointer);
}
}
@ -199,7 +196,6 @@ class RegionLoader{
public function close(){
$this->writeLocationTable();
flock($this->filePointer, LOCK_UN);
fclose($this->filePointer);
}