mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Remove level locks, possible fix for #2046
This commit is contained in:
parent
6fb7170556
commit
8c627bd0af
@ -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)){
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user