X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fauth.phh;h=fba09873e6ac772300d0f5da95ac622d004d6908;hb=f6a4ad0c8fed8ed0d3bab5fba9842cf00576c028;hp=8e74ffd996feda1e2c6e49168184e48cfb61f112;hpb=8fe1e432c4661ebf186026f920d778d37dbe0953;p=brisk.git diff --git a/web/Obj/auth.phh b/web/Obj/auth.phh index 8e74ffd..fba0987 100644 --- a/web/Obj/auth.phh +++ b/web/Obj/auth.phh @@ -179,7 +179,7 @@ class Challenges { $shm_sz = CHAL_SHM_DIMS_MIN; if ($shm = shm_attach($tok, $shm_sz)) { - $chals = @shm_get_var($shm, $tok); + $chals = @shm_get_var($shm, $tok); // CHECKED BELOW log_only("challenges == ".($chals == FALSE ? "FALSE" : "TRUE")." challenges === ".($chals === FALSE ? "FALSE" : "TRUE")." challenges isset ".(isset($chals) ? "TRUE" : "FALSE")); @@ -191,6 +191,7 @@ class Challenges { log_only("PUT_VAR FALLITA ".strlen(serialize($chals))); log_only(serialize($chals)); } + log_shme("Challenges::save_data2"); } $chals->shm_sz = $shm_sz; @@ -222,7 +223,8 @@ class Challenges { log_only("challenges count ".count($chals->item)." _n: ".$chals->item_n); $chals->mod = FALSE; - if (shm_put_var($shm, $tok, $chals) != FALSE) { + if (@shm_put_var($shm, $tok, $chals) != FALSE) { + log_shme("Challenges::save_data"); shm_detach($shm); return (TRUE); } @@ -242,31 +244,25 @@ class Challenges { return (FALSE); } - function lock_data() + static function lock_data($is_exclusive) { - if (($tok = @ftok(FTOK_PATH."/challenges", "B")) == -1) { - return (FALSE); - } - // echo "FTOK ".$tok."
"; - if (($res = sem_get($tok)) == 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); } - function unlock_data($res) + static function unlock_data($res) { GLOBAL $sess; log_lock("UNLOCK challenges [".(microtime(TRUE) - (self::$delta_t))."]"); - return (sem_release($res)); + file_unlock($res); } } // End CLASS Challenges