destroy_data process completed
authorMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Wed, 18 May 2011 21:43:26 +0000 (23:43 +0200)
committerMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Wed, 18 May 2011 21:43:26 +0000 (23:43 +0200)
web/Obj/brisk.phh
web/briskin5/Obj/briskin5.phh

index 039118e..c829980 100644 (file)
@@ -1145,7 +1145,8 @@ class Room {
                $this->room_join_wakeup($user_cur, FALSE, 0); 
                $table_cur->table_token = "";
                 $table_cur->wakeup_time = $curtime + WAKEUP_TIME;
-               Bin5::destroy_data($table_idx);
+                        
+                        $bri->destroy_data($table_idx);
              }
              else {
                log_main("gm:: save_data");
index 7b26f01..1bf46a3 100644 (file)
@@ -685,6 +685,36 @@ class Bin5_user extends User {
       return (FALSE);
   }
 
+  function destroy_data($tab_id) 
+  {
+      do {
+          if (($tok = @ftok(FTOK_PATH."/bin5/table".$tab_id."/user".$this->table_pos, "B")) == -1) {
+              log_crit("BIN5 USER DATA REMOVE FAILED 1 [".FTOK_PATH."/bin5/table".$tab_id."/user".$this->table_pos."]");
+              break;
+          }
+          
+          if (($shm = @shmop_open($tok, 'a', 0, 0)) == FALSE) {
+              log_crit("BIN5 USER DATA REMOVE FAILED 2");
+              break;
+          }
+          if (shmop_delete($shm) == 0) {
+              log_crit("BIN5 USER DATA REMOVE FAILED 3");
+              break;
+          }
+          $shm = FALSE;
+
+          log_main("BIN5 USER DATA DESTROY SUCCESS");
+          
+          // log_main("QUI CI ARRIVA [".$bri->user[0]->name."]");
+          $ret = TRUE;
+      } while (0);
+      
+      if ($shm)
+          shm_detach($shm);
+      
+      return ($ret);
+  }
+
 } // end class Bin5_user
 
 
@@ -924,7 +954,7 @@ class Bin5 {
   
 
 
-  function destroy_data($table_idx
+  function destroy_data() 
   {
     GLOBAL $sess;