X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Fbriskin5%2Findex_rd.php;h=1800f2115568bd403d18ef6793ed04866e4ab525;hb=8e74a78fab641d685d534a821f114eda7c2cdd78;hp=c027921c794dba9fa29e531cfc5b0d4250216135;hpb=d735a157e2d85d4fa21de7d0639ad0e5b0f756a8;p=brisk.git diff --git a/web/briskin5/index_rd.php b/web/briskin5/index_rd.php index c027921..1800f21 100644 --- a/web/briskin5/index_rd.php +++ b/web/briskin5/index_rd.php @@ -28,6 +28,12 @@ require_once("../Obj/brisk.phh"); // require_once("../Obj/proxyscan.phh"); require_once("Obj/briskin5.phh"); +$S_load_stat = array( 'U_first_loop' => 0, + 'U_heavy' => 0, + 'R_garbage' => 0, + 'R_minusone' => 0, + 'R_the_end' => 0 ); + // Use of proxies isn't allowed. // if (is_proxy()) { // sleep(5); @@ -46,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() @@ -70,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; @@ -82,13 +84,11 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su $user = FALSE; $curtime = time(); - if (($proxy_step = Bin5_user::step_get($sess)) == FALSE) { + if (($proxy_step = Bin5_user::load_step($sess)) == FALSE) { log_only2("R"); return (FALSE); } - error_log("maincheck: step di i [".$proxy_step['i']."]", 0); - // log_rd2("M"); /* Sync check (read only without modifications */ ignore_user_abort(TRUE); @@ -96,13 +96,15 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su if (($sem = Bin5::lock_data($table_idx)) != FALSE) { // Aggiorna l'expire time lato server $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()); } $user->lacc = $curtime; - Bin5_user::save_data($user, $proxy_step['i'], $user->idx); + + Bin5_user::save_data($user, $table_idx, $user->idx); if (Bin5::garbage_time_is_expired($curtime)) { log_only("F"); @@ -119,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 ... @@ -133,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 { @@ -146,10 +148,8 @@ 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 (($bri = &Bin5::load_data($table_idx, $table_token)) == FALSE) - // if (($user = Bin5_user::load_data($table_idx, $table_token)) == FALSE) if (($user = Bin5_user::load_data($table_idx, $proxy_step['i'], $sess)) == FALSE) { break; } @@ -175,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 */ @@ -270,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); @@ -358,6 +366,12 @@ for ($i = 0 ; time() < $endtime ; $i++) { echo '_'; flush(); } + } + +$s = "[".$sess."] briskin5/index_rd.php stats: "; +foreach ($S_load_stat as $key => $value) { + $s .= sprintf("%s: %d - ", $key, $value); } +log_crit($s); ?>