mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-10-22 16:55:21 +08:00
Fix parallel research exploit (#143)
* Fix parallel building exploit via race condition * Fix parallel research exploit via race condition --------- Co-authored-by: hdmaniak <[email protected]> Co-authored-by: Catalin Novgorodschi <[email protected]>
This commit is contained in:
co-authored by
hdmaniak
Catalin Novgorodschi
parent
e83985e7f7
commit
2e5f9f6169
@@ -4568,6 +4568,18 @@ References: User ID/Message ID, Mode
|
||||
mysqli_query($this->dblink, "SELECT RELEASE_LOCK('build_village_$wid')");
|
||||
}
|
||||
|
||||
function getResearchLock($wid) {
|
||||
$wid = (int) $wid;
|
||||
$result = mysqli_query($this->dblink, "SELECT GET_LOCK('research_village_$wid', 10) AS locked");
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
return $row['locked'] == 1;
|
||||
}
|
||||
|
||||
function releaseResearchLock($wid) {
|
||||
$wid = (int) $wid;
|
||||
mysqli_query($this->dblink, "SELECT RELEASE_LOCK('research_village_$wid')");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time required to build a specified building
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user