X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fauth.phh;h=a501014605c1939fe1cb8e89e3e67f14454d9228;hb=43cab39ea58529cd2442c28f4157bb7efc97856f;hp=36b75cab1f1f5343ed9b3b5b20978787a62a7d89;hpb=6a7088b090b78123ccfaa3ba00e1ea81647b173c;p=brisk.git diff --git a/web/Obj/auth.phh b/web/Obj/auth.phh index 36b75ca..a501014 100644 --- a/web/Obj/auth.phh +++ b/web/Obj/auth.phh @@ -24,11 +24,11 @@ require_once("${G_base}Obj/dbase_${G_dbasetype}.phh"); -define(CHAL_SHM_DIMS_MIN, 16384); -define(CHAL_SHM_DIMS_MAX, 65536); -define(CHAL_SHM_DIMS_DLT, 16384); -define(CHAL_VALID_TIME, 15); -define(CHAL_GARBAGE_TIMEOUT, 5); +define('CHAL_SHM_DIMS_MIN', 16384); +define('CHAL_SHM_DIMS_MAX', 65536); +define('CHAL_SHM_DIMS_DLT', 16384); +define('CHAL_VALID_TIME', 15); +define('CHAL_GARBAGE_TIMEOUT', 5); class Challenge { @@ -246,20 +246,14 @@ class Challenges { static function lock_data($is_exclusive) { - if (($tok = @ftok(FTOK_PATH."/challenges", "B")) == -1) { - return (FALSE); - } - // echo "FTOK ".$tok."
"; - if (($res = sem_get($tok, ($is_exclusive ? 1 : LOCK_SHARE_MAX) )) == FALSE) { - return (FALSE); - } - if (sem_acquire($res)) { - self::$delta_t = microtime(TRUE); - log_lock("LOCK challenges [".self::$delta_t."]"); - return ($res); - } - else - return (FALSE); + if (($res = file_lock(FTOK_PATH."/challenges", $is_exclusive)) != FALSE) { + self::$delta_t = microtime(TRUE); + log_lock("LOCK challenges [".self::$delta_t."]"); + + return ($res); + } + + return (FALSE); } static function unlock_data($res) @@ -268,7 +262,7 @@ class Challenges { log_lock("UNLOCK challenges [".(microtime(TRUE) - (self::$delta_t))."]"); - return (sem_release($res)); + file_unlock($res); } } // End CLASS Challenges