X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fbrisk.phh;h=799ea68bf2263bd0b3a8a9ef2d16f4f869c94fa2;hb=45fd3084c52ef5c560300fa32a2fef75edc47ca7;hp=ca9a14086c7ac413a847098bd2eed895966212ae;hpb=e469882b494df00aab18f2e38d18c5faa214c740;p=brisk.git diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index ca9a140..799ea68 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -814,6 +814,19 @@ class User { { $this->step = $step & 0x7fffffff; + return (TRUE); + } + + function step_inc($delta = 1) { + $this->step += $delta; + /* modularization because unpack() not manage unsigned 32bit int correctly */ + $this->step &= 0x7fffffff; + + return TRUE; + } + + function save_step() + { do { if (validate_sess($this->sess) == FALSE) break; @@ -823,7 +836,7 @@ class User { break; fwrite($fp, pack("LL",$this->step, $this->idx)); fclose($fp); - + log_main("step_set [".$this->sess. "] [".$this->step."]"); return (TRUE); @@ -832,27 +845,7 @@ class User { return (FALSE); } - function step_inc($delta = 1) { - $this->step += $delta; - /* modularization because unpack() not manage unsigned 32bit int correctly */ - $this->step &= 0x7fffffff; - - if (validate_sess($this->sess)) { - if (file_exists(PROXY_PATH) == FALSE) - mkdir(PROXY_PATH); - $fp = fopen(PROXY_PATH."/".$this->sess.".step", 'w'); - fwrite($fp, pack("LL", $this->step, $this->idx)); - fclose($fp); - - log_main("step_inc [".$this->sess. "] [".$this->step."]"); - - return (TRUE); - } - - return (FALSE); - } - - static function step_get($sess) + static function load_step($sess) { $fp = FALSE; do { @@ -938,7 +931,20 @@ class User { log_only(serialize($user)); } } - + else { + if ($sess != FALSE) { + /* + * NOTE: this part is for check only, theoretically + * user->step anch proxy_step are set allways at the same value + */ + $old_step = $user->step; + $arr = User::load_step($sess); + $user->step = $arr['s']; + if ($old_step != $user->step) { + log_crit("steps are diffetents User->step ".$user->step." Old_step: ".$old_step); + } + } + } $user->shm_sz = $shm_sz; shm_detach($shm); @@ -973,6 +979,8 @@ class User { // log_only("PUT_VAR DI ".strlen(serialize($user))); if (shm_put_var($shm, $tok, $user) != FALSE) { shm_detach($shm); + if ($user->sess != "") + $user->save_step(); log_main("User[".$id."] saved."); return (TRUE); }