X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Fbriskin5%2Findex_rd.php;h=1de3bd613d7f24e63f853d7cb6a93221290ac11d;hb=8e6645e3502b269d768bbb43e30b70bf96a2cdaf;hp=6732873b804870270256b543eda005dd401d05cc;hpb=45fd3084c52ef5c560300fa32a2fef75edc47ca7;p=brisk.git diff --git a/web/briskin5/index_rd.php b/web/briskin5/index_rd.php index 6732873..1de3bd6 100644 --- a/web/briskin5/index_rd.php +++ b/web/briskin5/index_rd.php @@ -52,10 +52,9 @@ if (DEBUGGING == "local" && $_SERVER['REMOTE_ADDR'] != '127.0.0.1') { function shutta() { - log_rd2("bin5 SHUTTA!".connection_status()); + log_rd2("bin5 SHUTTA [".connection_status()."] !"); } - register_shutdown_function(shutta); function unrecerror() @@ -76,9 +75,6 @@ function page_sync($sess, $page) return (sprintf('the_end=true; window.onbeforeunload = null; window.onunload = null; document.location.assign("%s");', $page)); } - - - function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_subst, &$new_step, $table_idx, $table_token) { GLOBAL $is_page_streaming, $first_loop, $S_load_stat; @@ -87,8 +83,8 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su $bri = FALSE; $user = FALSE; $curtime = time(); - - if (($proxy_step = Bin5_user::load_step($sess)) == FALSE) { + + if (($proxy_step = Bin5_user::load_step($table_idx, $sess)) == FALSE) { log_only2("R"); return (FALSE); } @@ -102,7 +98,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su $S_load_stat['U_first_loop']++; if (($user = Bin5_user::load_data($table_idx, $proxy_step['i'], $sess)) == FALSE) { - Bin5::unlock_data(); + Bin5::unlock_data($sem); ignore_user_abort(FALSE); return (unrecerror()); } @@ -110,7 +106,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su Bin5_user::save_data($user, $table_idx, $user->idx); - if (Bin5::garbage_time_is_expired($curtime)) { + if (Bin5::garbage_time_is_expired($table_idx, $curtime)) { log_only("F"); $S_load_stat['R_garbage']++; @@ -125,7 +121,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su Bin5::save_data($bri); unset($bri); } - log_lock("U"); + log_main("infolock: U"); Bin5::unlock_data($sem); ignore_user_abort(FALSE); } // if (($sem = Bin5::lock_data($table ... @@ -139,7 +135,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su } // if ($first_loop == TRUE) { if ($cur_step == $proxy_step['s']) { - log_lock("P"); + log_main("infolock: P"); return (FALSE); } else { @@ -152,7 +148,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su if (($sem = Bin5::lock_data($table_idx)) == FALSE) break; - log_lock("P"); + log_main("infolock: P"); $S_load_stat['U_heavy']++; if (($user = Bin5_user::load_data($table_idx, $proxy_step['i'], $sess)) == FALSE) { break; @@ -179,7 +175,11 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su */ ignore_user_abort(TRUE); $sem = Bin5::lock_data($table_idx); - $bri = Bin5::load_data($table_idx, $table_token); + if (($bri = Bin5::load_data($table_idx, $table_token)) == FALSE) { + Bin5::unlock_data($sem); + ignore_user_abort(FALSE); + return (unrecerror()); + } $S_load_stat['R_minusone']++; /* unset the $user var to reload it from main structure */ @@ -274,7 +274,11 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su log_auth($user->sess, "Explicit logout."); $S_load_stat['R_the_end']++; - $bri = Bin5::load_data($table_idx, $table_token); + if (($bri = Bin5::load_data($table_idx, $table_token)) == FALSE) { + Bin5::unlock_data($sem); + ignore_user_abort(FALSE); + return (unrecerror()); + } unset($user); if (($user = $bri->get_user($sess, $idx)) == FALSE) { Bin5::unlock_data($sem); @@ -284,7 +288,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su $tmp_sess = $user->sess; $user->sess = ""; - step_unproxy($tmp_sess); + Bin5_user::unproxy_step($tmp_sess); $user->name = ""; $user->the_end = FALSE; @@ -330,7 +334,7 @@ if (!isset($myfrom)) $myfrom = ""; if (!isset($subst)) $subst = ""; -log_rd2("FROM OUTSIDE - STAT: ".$stat." SUBST: ".$subst." STEP: ".$step." MYFROM: ".$myfrom. "IS_PAGE:" . $is_page_streaming."USER_AGENT:".$HTTP_USER_AGENT); +log_rd2("FROM OUTSIDE - STAT: ".$stat." SUBST: ".$subst." STEP: ".$step." MYFROM: ".$myfrom. "IS_PAGE:" . $is_page_streaming."USER_AGENT:".$HTTP_USER_AGENT." TABLE:".$table_idx); $endtime = time() + STREAM_TIMEOUT; @@ -343,7 +347,7 @@ for ($i = 0 ; time() < $endtime ; $i++) { $pre_main = gettimeofday(TRUE); if (($ret = maincheck($sess, $old_stat, $old_subst, $old_step, &$stat, &$subst, &$step, $table_idx, $table_token)) != FALSE) { echo '@BEGIN@'; - // log_rd2(sprintf("\nSESS: [%s]\nOLD_STAT: [%s] OLD_SUBST: [%s] OLD_STEP: [%s] \nSTAT: [%s] SUBST: [%s] STEP: [%s] \nCOMM: [%s]\n", $sess, $old_stat, $old_subst, $old_step, $stat, $subst, $step, $ret)); + log_rd2(sprintf("\nSESS: [%s]\nOLD_STAT: [%s] OLD_SUBST: [%s] OLD_STEP: [%s] \nSTAT: [%s] SUBST: [%s] STEP: [%s] \nCOMM: [%s]\n", $sess, $old_stat, $old_subst, $old_step, $stat, $subst, $step, $ret)); echo "$ret"; echo ' @END@'; log_send("EXT_STEP: ".$ext_step." ENDTIME: [".$endtime."] ".$ret);