From e71902002186de31f72f2ceed43f90dfc2efd19e Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Wed, 18 May 2011 23:21:21 +0200 Subject: [PATCH] unproxy functions refactored --- web/Obj/brisk.phh | 16 ++++++++-------- web/briskin5/Obj/briskin5.phh | 19 +++++++++++++++---- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 38bc1cf..4abdd86 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -893,13 +893,20 @@ class User { return (FALSE); } + static function unproxy_step($sess) { + log_rd2("UNPROXY: ".PROXY_PATH."/".$sess.".step"); + if (file_exists(PROXY_PATH) == FALSE) + return; + @unlink(PROXY_PATH."/".$sess.".step"); + } + function reset() { $curtime = time(); log_legal($curtime, $this, "STAT:LOGOUT", ''); $tmp_sess = $this->sess; $this->sess = ""; - step_unproxy($tmp_sess); + self::unproxy_step($tmp_sess); $this->name = ""; // OK here while (array_pop($this->comm) != NULL); $this->step = 0; @@ -1019,13 +1026,6 @@ class User { } // end class User -function step_unproxy($sess) { - log_rd2("UNPROXY: ".PROXY_PATH."/".$sess.".step"); - if (file_exists(PROXY_PATH) == FALSE) - mkdir(PROXY_PATH); - @unlink(PROXY_PATH."/".$sess.".step"); -} - class Room { static $delta_t; diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index ce2bdb8..7b26f01 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -570,6 +570,14 @@ class Bin5_user extends User { 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) { @@ -779,7 +787,7 @@ class Bin5 { $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; @@ -925,9 +933,12 @@ class Bin5 { 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) -- 2.17.1