{
$this->step = $step & 0x7fffffff;
- do {
- if (validate_sess($this->sess) == FALSE)
- break;
- if (file_exists(BIN5_PROXY_PATH) == FALSE)
- mkdir(BIN5_PROXY_PATH, 0775, TRUE);
- if (($fp = @fopen(BIN5_PROXY_PATH."/".$this->sess.".step", 'w')) == FALSE)
- break;
- fwrite($fp, pack("LL",$this->step, $this->idx));
- fclose($fp);
-
- log_main("step_set [".$this->sess. "] [".$this->step."]");
-
- return (TRUE);
- } while (0);
-
- return (FALSE);
+ return TRUE;
}
function step_inc($delta = 1) {
/* modularization because unpack() not manage unsigned 32bit int correctly */
$this->step &= 0x7fffffff;
- if (validate_sess($this->sess)) {
- if (file_exists(BIN5_PROXY_PATH) == FALSE)
- mkdir(BIN5_PROXY_PATH);
- $fp = fopen(BIN5_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);
+ return (TRUE);
}
-
- static function step_get($sess)
+
+ static function load_step($sess)
{
$fp = FALSE;
do {
return (FALSE);
}
+
+ function save_step()
+ {
+ do {
+ if (validate_sess($this->sess) == FALSE)
+ break;
+ if (file_exists(BIN5_PROXY_PATH) == FALSE)
+ mkdir(BIN5_PROXY_PATH, 0775, TRUE);
+ if (($fp = @fopen(BIN5_PROXY_PATH."/".$this->sess.".step", 'w')) == FALSE)
+ break;
+ fwrite($fp, pack("LL",$this->step, $this->idx));
+ fclose($fp);
+
+ log_main("step_set [".$this->sess. "] [".$this->step."]");
+
+ return (TRUE);
+ } while (0);
+
+ return (FALSE);
+ }
+
static function load_data($tab_id, $id, $sess)
{
- // error_log("Bin5_user::load_data BEGIN", 0);
- error_log("Bin5_user::load_data BEGIN id [".$id."]", 0);
-
- log_main("load_data: tab_id [".$tab_id."] id [".$id."] sess [".($sess == FALSE ? "FALSE" : $sess)."] ");
+ log_main("Bin5_user::load_data: tab_id [".$tab_id."] id [".$id."] sess [".($sess == FALSE ? "FALSE" : $sess)."] ");
$doexit = FALSE;
do {
break;
}
log_only("user == ".($user == FALSE ? "FALSE" : "TRUE")." user === ".($user === FALSE ? "FALSE" : "TRUE")." user isset ".(isset($user) ? "TRUE" : "FALSE"));
- if (isset($user))
- log_only("bri count ".count($user));
if ($user == FALSE) {
log_only("INIT MAIN DATA");
$shm = FALSE;
- // var_dump($user);
- error_log("Bin5_user::save_data BEGIN id [".$id."]", 0);
-
if (($tok = @ftok(FTOK_PATH."/bin5/table".$tab_id."/user".$id, "B")) == -1) {
return (FALSE);
}
var $table;
var $comm; // commands for many people
var $step; // current step of the comm array
- var $garbage_timeout;
+ // externalized var $garbage_timeout;
var $shm_sz;
var $table_idx;
$doexit = FALSE;
$shm = FALSE;
- log_wr("TABLE_IDX ".FTOK_PATH."/bin5/table".$table_idx."/table");
+ log_wr("TABLE_FTOK ".FTOK_PATH."/bin5/table".$table_idx."/table");
do {
if (($tok = @ftok(FTOK_PATH."/bin5/table".$table_idx."/table", "B")) == -1) {
return ($is_ab);
}
-} // end class Briskin5
+
+
+ static function garbage_time_is_expired($tm)
+ {
+ $ret = TRUE;
+ $fp = FALSE;
+ do {
+ if (file_exists(BIN5_PROXY_PATH) == FALSE)
+ mkdir(BIN5_PROXY_PATH);
+ if (($fp = @fopen(BIN5_PROXY_PATH."/garbage_time.expired", 'rb')) == FALSE)
+ break;
+ if (($s = fread($fp, 4)) == FALSE)
+ break;
+ if (strlen($s) != 4)
+ break;
+ $arr = unpack('Le', $s);
+ if ($arr['e'] > $tm)
+ $ret = FALSE;
+ } while (0);
+
+ if ($fp != FALSE)
+ fclose($fp);
+
+ log_rd2("END: return ".($ret ? "TRUE" : "FALSE"));
+
+ return ($ret);
+ }
+
+ static function garbage_time_expire_set($tm)
+ {
+ do {
+ if (file_exists(BIN5_PROXY_PATH) == FALSE)
+ mkdir(BIN5_PROXY_PATH);
+ if (($fp = @fopen(BIN5_PROXY_PATH."/garbage_time.expired", 'wb')) == FALSE)
+ break;
+ fwrite($fp, pack("L",$tm));
+ fclose($fp);
+
+ return (TRUE);
+ } while (0);
+
+ return (FALSE);
+ }
+
+} // end class Bin5
function locshm_exists($tok)
{