function load_data()
{
GLOBAL $sess;
- $doexit = FALSE;
do {
if (($tok = @ftok(FTOK_PATH."/challenges", "B")) == -1) {
log_main("ftok failed");
- $doexit = TRUE;
break;
}
return ($chals);
} while (0);
- if ($doexit)
- exit();
-
return (FALSE);
}
{
log_main("load_data: id [".$id."] sess [".($sess == FALSE ? "FALSE" : $sess)."] ");
- $doexit = FALSE;
do {
if (($tok = @ftok(FTOK_PATH."/user".$id, "B")) == -1) {
log_main("ftok failed");
- $doexit = TRUE;
break;
}
$user = @shm_get_var($shm, $tok);
if ($sess != FALSE && $user->sess != $sess) {
- $doexit = TRUE;
break;
}
log_only("user == ".($user == FALSE ? "FALSE" : "TRUE")." user === ".($user === FALSE ? "FALSE" : "TRUE")." user isset ".(isset($user) ? "TRUE" : "FALSE"));
return ($user);
} while (0);
- if ($doexit)
- exit();
-
return (FALSE);
}
// is the end of the table
if ($bri->the_end == TRUE) {
- /*
+ /*
* DESTROY OF FINISHED TABLE && MOVE PLAYER TO ROOM AGAIN
*/
log_main("garbage_manager: INSIDE THE END.");
function load_data()
{
GLOBAL $sess;
- $doexit = FALSE;
do {
if (($tok = @ftok(FTOK_PATH."/main", "B")) == -1) {
log_main("ftok failed");
- $doexit = TRUE;
break;
}
shm_detach($shm);
for ($i = 0 ; $i < MAX_PLAYERS ; $i++) {
- $room->user[$i] = User::load_data($i, FALSE);
+ if (($room->user[$i] = User::load_data($i, FALSE)) == FALSE) {
+ log_crit("Bin5_user::load_data failed");
+ break;
+ }
+ }
+ if ($i < MAX_PLAYERS) {
+ break;
}
}
return ($room);
} while (0);
- if ($doexit)
- exit();
-
return (FALSE);
}
function load_data()
{
GLOBAL $sess;
- $doexit = FALSE;
+
do {
if (($tok = @ftok(FTOK_PATH."/hardbans", "B")) == -1) {
log_main("ftok failed");
- $doexit = TRUE;
break;
}
return ($hban);
} while (0);
- if ($doexit)
- exit();
-
return (FALSE);
}
{
log_main("Bin5_user::load_data: tab_id [".$tab_id."] id [".$id."] sess [".($sess == FALSE ? "FALSE" : $sess)."] ");
- $doexit = FALSE;
do {
if (($tok = @ftok(FTOK_PATH."/bin5/table".$tab_id."/user".$id, "B")) == -1) {
log_main("ftok failed");
- $doexit = TRUE;
break;
}
$user = @shm_get_var($shm, $tok);
if ($sess != FALSE && $user->sess != $sess) {
- $doexit = TRUE;
break;
}
log_only("user == ".($user == FALSE ? "FALSE" : "TRUE")." user === ".($user === FALSE ? "FALSE" : "TRUE")." user isset ".(isset($user) ? "TRUE" : "FALSE"));
return ($user);
} while (0);
- if ($doexit)
- exit();
+ log_crit("Bin5_user::load_data:ret FALSE");
return (FALSE);
}
// Bin5::load_data
static function load_data($table_idx, $table_token = "")
{
- $doexit = FALSE;
$shm = FALSE;
log_wr("TABLE_FTOK ".FTOK_PATH."/bin5/table".$table_idx."/table");
do {
if (($tok = @ftok(FTOK_PATH."/bin5/table".$table_idx."/table", "B")) == -1) {
log_main("ftok failed");
- $doexit = TRUE;
break;
}
shm_detach($shm);
for ($i = 0 ; $i < BIN5_MAX_PLAYERS ; $i++) {
- $bri->user[$i] = Bin5_user::load_data($table_idx, $i, FALSE);
+ if (($bri->user[$i] = Bin5_user::load_data($table_idx, $i, FALSE)) == FALSE) {
+ log_crit("Bin5_user::load_data failed");
+ break;
+ }
+ }
+ if ($i < BIN5_MAX_PLAYERS) {
+ break;
}
return ($bri);
shm_detach($shm);
log_wr("briskin5 load_data failed");
- if ($doexit)
- exit();
return (FALSE);
}
*/
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 */
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);
$is_table = FALSE;
$sem = Room::lock_data();
log_main("lock Room");
- $room = Room::load_data();
+ if (($room = Room::load_data()) == FALSE) {
+ log_crit("load_data failed");
+ exit();
+ }
$curtime = time();
/* Actions */
*/
ignore_user_abort(TRUE);
$sem = Room::lock_data();
- $room = Room::load_data();
+ if (($room = Room::load_data()) == FALSE) {
+ Room::unlock_data($sem);
+ ignore_user_abort(FALSE);
+ return (unrecerror());
+ }
$S_load_stat['R_minusone']++;
/* unset the $user var to reload it from main structure */
log_auth($user->sess, "Explicit logout.");
$S_load_stat['R_the_end']++;
- $room = Room::load_data();
+ if (($room = Room::load_data()) == FALSE) {
+ Room::unlock_data($sem);
+ ignore_user_abort(FALSE);
+ return (unrecerror());
+ }
+
unset($user);
if (($user = $room->get_user($sess, $idx)) == FALSE) {
Room::unlock_data($sem);