- log_rd2("TRANS NON ATTIVATO");
-
-// ARRAY_POP DISABLED
-// while (array_pop($user->comm) != NULL);
-// // $user->step_inc(COMM_N + 1);
-// Briskin5::save_data($bri);
-
- Briskin5::unlock_data($sem);
- ignore_user_abort(FALSE);
- }
- }
-
- if ($cur_step == -1) {
- log_rd2("PRE-NEWSTAT.");
-
- /***************
- * *
- * TABLE *
- * *
- ***************/
- if ($user->stat == "table") {
- $ret = show_table(&$bri,&$user,$user->step,FALSE,FALSE);
-
- log_rd2("SENDED TO THE STREAM: ".$ret);
- }
- log_rd2("NEWSTAT: ".$user->stat);
-
- $new_stat = $user->stat;
- $new_subst = $user->subst;
- $new_step = $user->step;
- }
- else {
- ignore_user_abort(TRUE);
- $sem = Briskin5::lock_data($table_idx);
- if (($bri = &Briskin5::load_data($table_idx, $table_token)) == FALSE) {
- Briskin5::unlock_data($sem);
- ignore_user_abort(FALSE);
- return (unrecerror());
- }
- if (($user = &$bri->get_user($sess, $idx)) == FALSE) {
- Briskin5::unlock_data($sem);
- ignore_user_abort(FALSE);
- return (unrecerror());
- }
- if ($cur_step < $user->step) {
- do {
- if ($cur_step + COMM_N < $user->step) {
- if (($cur_stat != $user->stat)) {
- $to_stat = $user->stat;
- Briskin5::unlock_data($sem);
- ignore_user_abort(FALSE);
- return (page_sync($user->sess, $to_stat == "table" ? "index.php" : "../index.php"));
- }
- log_rd2("lost history, refresh from scratch");
- $new_step = -1;
- break;
- }
- for ($i = $cur_step ; $i < $user->step ; $i++) {
- $ii = $i % COMM_N;
- log_wr("TRY RET ".$i." COMM_N ".COMM_N." II ".$ii);
- $ret .= $user->comm[$ii];
- }
- $new_stat = $user->stat;
- $new_subst = $user->subst;
- $new_step = $user->step;
- } while (0);
-
- log_mop($user->step, 'bin::index_rd.php: after ret set');
-
- if ($user->the_end == TRUE) {
- log_rd2("LOGOUT BYE BYE!!");
- log_auth($user->sess, "Explicit logout.");
- $tmp_sess = $user->sess;
- $user->sess = "";
- step_unproxy($tmp_sess);
-
- $user->name = "";
- $user->the_end = FALSE;
-
- if ($user->subst == 'sitdown')
- $bri->room_wakeup(&$user);
- else if ($user->subst == 'standup')
- $bri->room_outstandup(&$user);
- else
- log_rd2("LOGOUT FROM WHAT ???");
-
- Briskin5::save_data($bri);
- }
- }
-
- Briskin5::unlock_data($sem);
- ignore_user_abort(FALSE);
+ ignore_user_abort(TRUE);
+ $sem = Bin5::lock_data(TRUE, $table_idx);
+ // if (($user = &$bri->get_user($sess, $idx)) == FALSE) {
+ if (($user = Bin5_user::load_data($table_idx, $proxy_step['i'], $sess)) == FALSE) {
+ Bin5::unlock_data($sem);
+ ignore_user_abort(FALSE);
+ return (blocking_error(TRUE));
+ }
+ if ($cur_step < $user->step) {
+ do {
+ if ($cur_step + COMM_N < $user->step) {
+ if (($cur_stat != $user->stat)) {
+ $to_stat = $user->stat;
+ Bin5::unlock_data($sem);
+ ignore_user_abort(FALSE);
+ return (page_sync($user->sess, $to_stat == "table" ? "index.php" : "../index.php"));
+ }
+ log_rd2("lost history, refresh from scratch");
+ $new_step = -1;
+ break;
+ }
+ for ($i = $cur_step ; $i < $user->step ; $i++) {
+ $ii = $i % COMM_N;
+ log_wr("TRY RET ".$i." COMM_N ".COMM_N." II ".$ii);
+ $ret .= $user->comm[$ii];
+ }
+ $new_stat = $user->stat;
+ $new_subst = $user->subst;
+ $new_step = $user->step;
+ } while (0);
+
+ log_rd2($user->step, 'bin::index_rd.php: after ret set');
+
+ if ($user->the_end == TRUE) {
+ log_rd2("LOGOUT BYE BYE!!");
+ log_auth($user->sess, "Explicit logout.");
+
+ unset($user);
+
+ $S_load_stat['wR_the_end']++;
+ if (($bri = Bin5::load_data($table_idx, $table_token)) == FALSE) {
+ Bin5::unlock_data($sem);
+ ignore_user_abort(FALSE);
+ return (blocking_error(TRUE));
+ }
+ if (($user = $bri->get_user($sess, $idx)) == FALSE) {
+ Bin5::unlock_data($sem);
+ ignore_user_abort(FALSE);
+ return (blocking_error(TRUE));
+ }
+
+ $tmp_sess = $user->sess;
+ $user->sess = "";
+ Bin5_user::unproxy_step($tmp_sess);
+ $user->name = "";
+ $user->the_end = FALSE;
+
+ /* FIXME - and now ??
+ if ($user->subst == 'sitdown')
+ $bri->room_wakeup($user);
+ else if ($user->subst == 'standup')
+ $bri->room_outstandup($user);
+ else
+ log_rd2("LOGOUT FROM WHAT ???");
+ */
+ Bin5::save_data($bri);
+ }
+ }
+
+ Bin5::unlock_data($sem);
+ ignore_user_abort(FALSE);