X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Fbriskin5%2FObj%2Fbriskin5.phh;h=9699d87a3595ee2761b28fd695da787735db9cb7;hb=5aa7e7651db7e4a565550fe8ff9f10c0dcba2a36;hp=29959721ac591b8c414d8ceace160b80c89162b1;hpb=e85c7217ac848be97c48bb14ddc2858289fbf34a;p=brisk.git diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index 2995972..9699d87 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -533,7 +533,7 @@ class Bin5_user extends User { break; if (($s = fread($fp, 8)) == FALSE) break; - if (strlen($s) != 8) + if (mb_strlen($s, "ASCII") != 8) break; $arr = unpack('Ls/Li', $s); fclose($fp); @@ -609,6 +609,19 @@ class Bin5_user extends User { log_only(serialize($user)); } } + else { + if ($sess != FALSE) { + // This part isn't strictly required but is good to verify + // the coerence of cached and User class saved value of step field. + $old_step = $user->step; + $arr = Bin5_user::load_step($sess); + $user->step = $arr['s']; + if ($old_step != $user->step) { + log_crit("Bin5:: steps are diffetents User->step ".$user->step." Old_step: ".$old_step); + } + + } + } $user->shm_sz = $shm_sz; @@ -643,6 +656,7 @@ class Bin5_user extends User { // log_only("PUT_VAR DI ".strlen(serialize($user))); if (shm_put_var($shm, $tok, $user) != FALSE) { shm_detach($shm); + $user->save_step(); log_main("User[".$id."] saved."); return (TRUE); } @@ -665,6 +679,8 @@ class Bin5_user extends User { class Bin5 { + static $delta_t = array(); + var $user; var $table; var $comm; // commands for many people @@ -931,7 +947,7 @@ class Bin5 { { GLOBAL $sess; - log_lock("LOCK_DATA ".FTOK_PATH."/bin5/table".$table_idx."/table"); + log_main("lockinfo: DATA ".FTOK_PATH."/bin5/table".$table_idx."/table"); // echo "LOCK: ".FTOK_PATH."/main"; // exit; // WARNING monitor this step @@ -943,20 +959,25 @@ class Bin5 { return (FALSE); } if (sem_acquire($res)) { - log_lock("LOCK table ".$table_idx."[res: ".$res."]"); - return ($res); + self::$delta_t[$table_idx] = microtime(TRUE); + log_lock("LOCK table [".$table_idx."] [".self::$delta_t[$table_idx]."]"); + + return (new Vect(array('res' => $res, 'tab' => $table_idx))); } else { - log_lock("LOCK table ".$table_idx.":FAILED"); - return (FALSE); + log_lock("LOCK table ".$table_idx.":FAILED"); + return (FALSE); } } - function unlock_data($res) + function unlock_data($res_vect) { GLOBAL $sess; - - log_lock("UNLOCK table [res: ".$res."]"); + + $res = $res_vect->getbyid('res'); + $tab = $res_vect->getbyid('tab'); + + log_lock("UNLOCK table [".$tab."] [".(microtime(TRUE) - (self::$delta_t[$tab]))."]"); return (sem_release($res)); } @@ -1144,7 +1165,7 @@ class Bin5 { break; if (($s = fread($fp, 4)) == FALSE) break; - if (strlen($s) != 4) + if (mb_strlen($s, "ASCII") != 4) break; $arr = unpack('Le', $s); if ($arr['e'] > $tm)