mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-09 14:16:08 +00:00
Fix parallel training exploit (#145)
* Fix parallel building exploit via race condition * Fix parallel research exploit via race condition * Fix parallel training exploit --------- Co-authored-by: hdmaniak <bombo15.forum@gmail.com> Co-authored-by: Catalin Novgorodschi <1140613+Shadowss@users.noreply.github.com>
This commit is contained in:
@@ -4580,6 +4580,18 @@ References: User ID/Message ID, Mode
|
||||
mysqli_query($this->dblink, "SELECT RELEASE_LOCK('research_village_$wid')");
|
||||
}
|
||||
|
||||
function getTrainingLock($wid) {
|
||||
$wid = (int) $wid;
|
||||
$result = mysqli_query($this->dblink, "SELECT GET_LOCK('train_village_$wid', 10) AS locked");
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
return $row['locked'] == 1;
|
||||
}
|
||||
|
||||
function releaseTrainingLock($wid) {
|
||||
$wid = (int) $wid;
|
||||
mysqli_query($this->dblink, "SELECT RELEASE_LOCK('train_village_$wid')");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time required to build a specified building
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user