backport 0c31b8731fe68bd56dbbfcc5eed77dedef914664: PocketMine.php: get rid of redundant LOCK_FILE_PATH constant

This commit is contained in:
Dylan K. Taylor 2019-08-25 17:39:57 +01:00
parent 9a51ba697a
commit 1163ac1d7a

View File

@ -213,8 +213,7 @@ namespace pocketmine {
mkdir(\pocketmine\DATA, 0777, true); mkdir(\pocketmine\DATA, 0777, true);
} }
define('pocketmine\LOCK_FILE_PATH', \pocketmine\DATA . 'server.lock'); define('pocketmine\LOCK_FILE', fopen(\pocketmine\DATA . 'server.lock', "a+b"));
define('pocketmine\LOCK_FILE', fopen(\pocketmine\LOCK_FILE_PATH, "a+b"));
if(!flock(\pocketmine\LOCK_FILE, LOCK_EX | LOCK_NB)){ if(!flock(\pocketmine\LOCK_FILE, LOCK_EX | LOCK_NB)){
//wait for a shared lock to avoid race conditions if two servers started at the same time - this makes sure the //wait for a shared lock to avoid race conditions if two servers started at the same time - this makes sure the
//other server wrote its PID and released exclusive lock before we get our lock //other server wrote its PID and released exclusive lock before we get our lock