return (FALSE);
}
+ static function unproxy_step($tab_id, $sess)
+ {
+ log_rd2("UNPROXY: ".BIN5_PROXY_PATH."/table".$tab_id."/".$sess.".step");
+ if (file_exists(BIN5_PROXY_PATH."/table".$tab_id) == FALSE)
+ return;
+
+ @unlink(BIN5_PROXY_PATH."/table".$tab_id."/".$sess.".step");
+ }
static function load_data($tab_id, $id, $sess)
{
$shm_sz = SHM_DIMS_U_MIN;
if ($shm = shm_attach($tok, $shm_sz)) {
- $user = @shm_get_var($shm, $tok);
+ if (($user = @shm_get_var($shm, $tok)) == FALSE) {
+ break;
+ }
if ($sess != FALSE && $user->sess != $sess) {
break;
// SHSPLIT FIXME: init_data for User class ??
$user = User::create($id, "", "");
if (@shm_put_var($shm, $tok, $user) == FALSE) {
+ log_shme("Bin5_user::save_data2");
+
log_only("PUT_VAR FALLITA ".strlen(serialize($user)));
log_only(serialize($user));
}
break;
// log_only("PUT_VAR DI ".strlen(serialize($user)));
- if (shm_put_var($shm, $tok, $user) != FALSE) {
+ if (@shm_put_var($shm, $tok, $user) != FALSE) {
shm_detach($shm);
$user->save_step();
log_main("User[".$id."] saved.");
+
+ log_shme("Bin5_user::save_data");
+
return (TRUE);
}
if (shm_remove($shm) === FALSE) {
$tmp_sess = $user_cur->sess;
$user_cur->sess = "";
- step_unproxy($tmp_sess);
+ Bin5_user::step_unproxy($tmp_sess);
$user_cur->name = "";
$user_cur->the_end = FALSE;
break;
if (@shm_put_var($shm, $bri->tok, $bri) != FALSE) {
+
+ log_shme("Bin5::save_data");
+
$ret = TRUE;
break;
}
log_main("DESTROY BRISKIN5 DATA");
do {
- log_main("DESTROY2 BRISKIN5 DATA");
-
- if (($tok = @ftok(FTOK_PATH."/bin5/table".$table_idx."/table", "B")) == -1)
+ log_main("DESTROY2 BRISKIN5 DATA [".$this->table_idx."]");
+ for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) {
+ $this->user[$i]->destroy_data($this->table_idx);
+ Bin5_user::unproxy_step($this->table_idx, $this->user[$i]->sess);
+ }
+ if (($tok = @ftok(FTOK_PATH."/bin5/table".$this->table_idx."/table", "B")) == -1)
break;
if (($shm = @shmop_open($tok, 'a', 0, 0)) == FALSE)