X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;ds=inline;f=web%2FObj%2Fbrisk.phh;h=8de27bd345684ac29442babce8864d9b89405231;hb=93809fbf156343b87f540d7eb2d20506a51ee365;hp=7460da5388ef365b45fa4c93d4c57e241b558aad;hpb=f8d98f354ae51f7223e08e8a3dfaa2b2b466c8dc;p=brisk.git
diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh
index 7460da5..8de27bd 100644
--- a/web/Obj/brisk.phh
+++ b/web/Obj/brisk.phh
@@ -599,7 +599,8 @@ define(USER_FLAG_TY_SUSPEND, 0x400000); // done
define(USER_FLAG_TY_DISABLE, 0x800000); // done
class User {
- var $idx; // index in the users array
+ var $idx; // index in the users array when you are in game
+ var $idx_orig; // index in the users array when you aren't in game
var $code; // authentication code
var $name; // name of the user
var $sess; // session of the user
@@ -619,8 +620,8 @@ class User {
// FIXME: the table_orig field must be removed after table field verify of index management (in spawned table
// it is allways ZERO
- var $table_orig; // id of the current table (if in table state)
- var $table; // id of the current table (if in table state)
+ var $table; // id of the current table when you are in game
+ var $table_orig; // id of the current table when you aren't in game
var $table_pos; // idx on the table
var $table_token;// token that identify a game on a table
var $flags; // Bitfield with: AUTHENTICATE: 0x02
@@ -642,36 +643,37 @@ class User {
if (($thiz =& new User()) == FALSE)
return (FALSE);
- $thiz->idx = $idx;
- $thiz->code = -1;
- $thiz->name = $name;
- $thiz->sess = $sess;
- $thiz->ip = $ip;
- $thiz->lacc = time();
- $thiz->laccwr = time();
- $thiz->bantime = 0;
- $thiz->stat = $stat;
- $thiz->subst = $subst;
- $thiz->step = 1;
- $thiz->trans_step = -1;
- $thiz->comm = array();
- $thiz->asta_card = -2;
- $thiz->asta_pnt = -1;
- $thiz->handpt = -1;
+ $thiz->idx = $idx;
+ $thiz->idx_orig = $idx;
+ $thiz->code = -1;
+ $thiz->name = $name;
+ $thiz->sess = $sess;
+ $thiz->ip = $ip;
+ $thiz->lacc = time();
+ $thiz->laccwr = time();
+ $thiz->bantime = 0;
+ $thiz->stat = $stat;
+ $thiz->subst = $subst;
+ $thiz->step = 1;
+ $thiz->trans_step = -1;
+ $thiz->comm = array();
+ $thiz->asta_card = -2;
+ $thiz->asta_pnt = -1;
+ $thiz->handpt = -1;
$thiz->exitislock = TRUE;
- $thiz->flags = 0x00;
+ $thiz->flags = 0x00;
- $thiz->chattime = array_fill(0, CHAT_N, 0);
- $thiz->chat_cur = 0;
- $thiz->chat_lst = "";
- $thiz->chat_ban = 0;
- $thiz->chat_dlt = 0;
+ $thiz->chattime = array_fill(0, CHAT_N, 0);
+ $thiz->chat_cur = 0;
+ $thiz->chat_lst = "";
+ $thiz->chat_ban = 0;
+ $thiz->chat_dlt = 0;
$thiz->table_orig = $table;
$thiz->table = $table;
- $thiz->table_pos = -1;
- $thiz->table_token = "";
+ $thiz->table_pos = -1;
+ $thiz->table_token= "";
$thiz->shm_sz = SHM_DIMS_U_MIN;
return ($thiz);
}
@@ -679,6 +681,7 @@ class User {
function copy($from)
{
$this->idx = $from->idx;
+ $this->idx_orig = $from->idx;
$this->code = $from->code;
$this->name = $from->name;
$this->sess = $from->sess;
@@ -704,15 +707,15 @@ class User {
$this->handpt = $from->handpt;
$this->exitislock = $from->exitislock;
- $this->flags = $from->flags;
+ $this->flags = $from->flags;
- $this->chattime = array();
+ $this->chattime = array();
for ($i = 0 ; $i < CHAT_N ; $i++)
$this->chattime[$i] = $from->chattime[$i];
- $this->chat_cur = $from->chat_cur;
- $this->chat_lst = $from->chat_lst;
- $this->chat_ban = $from->chat_ban;
- $this->chat_dlt = $from->chat_dlt;
+ $this->chat_cur = $from->chat_cur;
+ $this->chat_lst = $from->chat_lst;
+ $this->chat_ban = $from->chat_ban;
+ $this->chat_dlt = $from->chat_dlt;
$this->table_orig = $from->table_orig;
$this->table = $from->table;
@@ -740,6 +743,7 @@ class User {
return (FALSE);
$thiz->idx = $from->idx;
+ $thiz->idx_orig = $from->idx;
$thiz->code = $from->code;
$thiz->name = $from->name;
$thiz->sess = $from->sess;
@@ -895,7 +899,11 @@ class User {
if ($shm = shm_attach($tok, $shm_sz)) {
$user = @shm_get_var($shm, $tok);
- log_only("bri == ".($user == FALSE ? "FALSE" : "TRUE")." bri === ".($user === FALSE ? "FALSE" : "TRUE")." bri isset ".(isset($user) ? "TRUE" : "FALSE"));
+ 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"));
if (isset($user))
log_only("bri count ".count($user));
@@ -903,7 +911,7 @@ class User {
log_only("INIT MAIN DATA");
// SHSPLIT FIXME: init_data for User class ??
- $user =& User::create($id, "", "");
+ $user = User::create($id, "", "");
if (@shm_put_var($shm, $tok, $user) == FALSE) {
log_only("PUT_VAR FALLITA ".strlen(serialize($user)));
log_only(serialize($user));
@@ -928,7 +936,7 @@ class User {
}
- function save_data(&$user, $id)
+ function save_data($user, $id)
{
GLOBAL $sess;
@@ -947,6 +955,7 @@ class User {
// log_only("PUT_VAR DI ".strlen(serialize($user)));
if (shm_put_var($shm, $tok, $user) != FALSE) {
shm_detach($shm);
+ log_main("User[".$id."] saved.");
return (TRUE);
}
if (shm_remove($shm) === FALSE) {
@@ -1010,7 +1019,7 @@ class Room {
var $table;
var $comm; // commands for many people
var $step; // current step of the comm array
- var $garbage_timeout;
+ // externalized var $garbage_timeout;
var $shm_sz;
function Room () {
@@ -1038,7 +1047,8 @@ class Room {
else
$this->table[$i]->auth_only = FALSE;
}
- $this->garbage_timeout = 0;
+ // externalized $this->garbage_timeout = 0;
+ Room::garbage_time_expire_set(0);
$this->shm_sz = SHM_DIMS_MIN;
}
@@ -1052,7 +1062,9 @@ class Room {
/* Garbage collector degli utenti in timeout */
$curtime = time();
- if ($force || $this->garbage_timeout < $curtime) {
+
+ // externalized if ($force || $this->garbage_timeout < $curtime) {
+ if ($force || Room::garbage_time_is_expired($curtime)) {
// FIXME BRISK4: include for each kind of table
require_once("${G_base}briskin5/Obj/briskin5.phh");
@@ -1065,11 +1077,11 @@ class Room {
if ($table_cur->player_n == PLAYERS_N) {
log_main("PLAYERS == N TABLE ".$table_idx);
- if (($sem = Briskin5::lock_data($table_idx)) != FALSE) {
+ if (($sem = Bin5::lock_data($table_idx)) != FALSE) {
log_main("bin5 lock data success");
$no_recovery = FALSE;
- if (($bri = &Briskin5::load_data($table_idx)) != FALSE) {
+ if (($bri = Bin5::load_data($table_idx)) != FALSE) {
if ($table_cur->table_token != $bri->table_token) {
log_main("ERROR: not matching table_token. Room: ".$table_cur->table_token." Table: ".$bri->table_token);
log_main("ERROR: not matching table_start. Room: ".$table_cur->table_start." Table: ".$bri->table_start);
@@ -1116,7 +1128,7 @@ class Room {
$this->room_join_wakeup(&$user_cur, FALSE, 0);
$table_cur->table_token = "";
$table_cur->wakeup_time = $curtime + WAKEUP_TIME;
- Briskin5::destroy_data($table_idx);
+ Bin5::destroy_data($table_idx);
}
else {
log_main("gm:: save_data");
@@ -1125,9 +1137,9 @@ class Room {
$this->user[$table_cur->player[$i]]->lacc = $bri->user[$i]->lacc;
}
- Briskin5::save_data(&$bri);
+ Bin5::save_data(&$bri);
}
- } // else if (($bri = &Briskin5::load_data($table_idx)) != FALSE) {
+ } // else if (($bri = &Bin5::load_data($table_idx)) != FALSE) {
else if ($no_recovery == FALSE) {
log_crit("ERROR: table ".$table_idx." unrecoverable join");
@@ -1155,7 +1167,7 @@ class Room {
$table_cur->table_token = "";
}
- Briskin5::unlock_data($sem);
+ Bin5::unlock_data($sem);
} // bri::lock_data
} // if ($table_cur->player_n == PLAYERS_N) {
} // for ($table_idx = 0 ; $table_idx < TABLES_N ; $table_idx++) {
@@ -1201,7 +1213,8 @@ class Room {
}
log_rd2("GARBAGE UPDATED!");
- $this->garbage_timeout = time() + GARBAGE_TIMEOUT;
+ // externalized $this->garbage_timeout = time() + GARBAGE_TIMEOUT;
+ Room::garbage_time_expire_set(time() + GARBAGE_TIMEOUT);
$ismod = TRUE;
}
@@ -1927,9 +1940,9 @@ class Room {
$bri_user->comm[$bri_user->step % COMM_N] .= $to_tabl;
$bri_user->step_inc();
}
- Briskin5::save_data(&$bri);
+ Bin5::save_data(&$bri);
}
- Briskin5::unlock_data($sem);
+ Bin5::unlock_data($sem);
} // bri::lock_data
} // if ($table_cur->player_n == PLAYERS_N) {
} // for ($table_idx = 0 ; $table_idx < TABLES_N ; $table_idx++) {
@@ -2083,15 +2096,15 @@ class Room {
if ($ghost_user->stat == "table" && $this->table[$table_idx]->player_n == PLAYERS_N) {
// FIXME BRISK4: include for each kind of table
require_once("${G_base}briskin5/Obj/briskin5.phh");
- if (($brisem = Briskin5::lock_data($table_idx)) != FALSE) {
- if (($bri = &Briskin5::load_data($table_idx)) != FALSE) {
+ if (($brisem = Bin5::lock_data($table_idx)) != FALSE) {
+ if (($bri = &Bin5::load_data($table_idx)) != FALSE) {
if ($bri->the_end != TRUE) {
$bri->user[$ghost_user->table_pos]->step_inc();
$bri->user[$ghost_user->table_pos]->sess = $sess;
- Briskin5::save_data(&$bri);
+ Bin5::save_data(&$bri);
}
}
- Briskin5::unlock_data($brisem);
+ Bin5::unlock_data($brisem);
}
}
@@ -2274,7 +2287,7 @@ class Room {
shm_detach($shm);
for ($i = 0 ; $i < MAX_PLAYERS ; $i++) {
- $room->user[$i] = User::load_data($i);
+ $room->user[$i] = User::load_data($i, FALSE);
}
}
@@ -2372,32 +2385,33 @@ class Room {
User::save_data($user_park[$i], $i);
$room->user[$i] = $user_park[$i];
}
+ log_load("FINISH: ".($ret == TRUE ? "TRUE" : "FALSE"));
return ($ret);
}
- function lock_data()
+ static function lock_data()
{
- GLOBAL $sess;
-
- // echo "LOCK: ".FTOK_PATH."/main";
- // exit;
- if (($tok = @ftok(FTOK_PATH."/main", "B")) == -1) {
- return (FALSE);
- }
- // echo "FTOK ".$tok."
";
- if (($res = sem_get($tok)) == FALSE) {
- return (FALSE);
- }
- if (sem_acquire($res)) {
- log_lock("LOCK room");
- return ($res);
- }
- else
- return (FALSE);
+ GLOBAL $sess;
+
+ // echo "LOCK: ".FTOK_PATH."/main";
+ // exit;
+ if (($tok = @ftok(FTOK_PATH."/main", "B")) == -1) {
+ return (FALSE);
+ }
+ // echo "FTOK ".$tok."
";
+ if (($res = sem_get($tok)) == FALSE) {
+ return (FALSE);
+ }
+ if (sem_acquire($res)) {
+ log_lock("LOCK room");
+ return ($res);
+ }
+ else
+ return (FALSE);
}
- function unlock_data($res)
+ static function unlock_data($res)
{
GLOBAL $sess;
@@ -2481,6 +2495,49 @@ class Room {
return ($ret);
}
+ static function garbage_time_is_expired($tm)
+ {
+ $ret = TRUE;
+ $fp = FALSE;
+ do {
+ if (file_exists(PROXY_PATH) == FALSE)
+ mkdir(PROXY_PATH);
+ if (($fp = @fopen(PROXY_PATH."/room_garbage_time.expired", 'rb')) == FALSE)
+ break;
+ if (($s = fread($fp, 4)) == FALSE)
+ break;
+ if (strlen($s) != 4)
+ break;
+ $arr = unpack('Le', $s);
+ if ($arr['e'] > $tm)
+ $ret = FALSE;
+ } while (0);
+
+ if ($fp != FALSE)
+ fclose($fp);
+
+ log_rd2("END: return ".($ret ? "TRUE" : "FALSE"));
+
+ return ($ret);
+ }
+
+ static function garbage_time_expire_set($tm)
+ {
+ do {
+ if (file_exists(PROXY_PATH) == FALSE)
+ mkdir(PROXY_PATH);
+ if (($fp = @fopen(PROXY_PATH."/room_garbage_time.expired", 'wb')) == FALSE)
+ break;
+ fwrite($fp, pack("L",$tm));
+ fclose($fp);
+
+ return (TRUE);
+ } while (0);
+
+ return (FALSE);
+ }
+
+
} // end class Room
function make_seed()
@@ -2489,240 +2546,282 @@ function make_seed()
return (float) $sec + ((float) $usec * 100000);
}
+function btrace_line($ar)
+{
+ GLOBAL $G_btrace_pref_sub;
-function log_mop($step, $log) {
- GLOBAL $sess, $PHP_SELF;
-
- if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_LMOP) == 0)
- return;
-
- if (isset($sess) == FALSE)
- $ssess = "XXXX";
- else
- $ssess = $sess;
-
- if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_LMOP) == 0)
- return;
-
- if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
- fwrite($fp, sprintf("LMOP: [%f] [%05d] [%s] [%s]\n", gettimeofday(TRUE), $step, $PHP_SELF, $log));
- fclose($fp);
- }
+ $ret = "";
+ for ($i = 0 ; $i < count($ar) ; $i++) {
+ $with_class = isset($ar[$i]['class']);
+ $with_file = isset($ar[$i]['file']);
+ $ret .= sprintf("%s%s%s (%s:%d)", ($i == 0 ? "" : ", "),
+ ($with_class ? $ar[$i]['class'].$ar[$i]['type'] : ""),
+ $ar[$i]['function'], ($with_file ? str_replace($G_btrace_pref_sub, "", $ar[$i]['file']) : ""),
+ ($with_file ? $ar[$i]['line'] : ""));
+ }
+
+ return ($ret);
}
-
-function log_only2($log) {
- GLOBAL $sess, $PHP_SELF;
-
- if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_ONL2) == 0)
- return;
-
- if (isset($sess) == FALSE)
- $ssess = "XXXX";
- else
- $ssess = $sess;
-
- if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_ONL2) == 0)
- return;
-
- if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
- fwrite($fp, sprintf("ONL2: [%s] [%s] [%s]\n", $ssess, $PHP_SELF, $log));
- fclose($fp);
- }
+function log_mop($step, $log)
+{
+ GLOBAL $sess, $PHP_SELF;
+
+ if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_LMOP) == 0)
+ return;
+
+ if (isset($sess) == FALSE)
+ $ssess = "XXXX";
+ else
+ $ssess = $sess;
+
+ if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_LMOP) == 0)
+ return;
+
+ $btrace = btrace_line(debug_backtrace());
+ if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
+ fwrite($fp, sprintf("LMOP: [%f] [%05d] [%s] [%s]\n", gettimeofday(TRUE), $step, $log, $btrace));
+ fclose($fp);
+ }
}
-function log_crit($log) {
- GLOBAL $sess, $PHP_SELF;
-
- if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_CRIT) == 0)
- return;
-
- if (isset($sess) == FALSE)
- $ssess = "XXXX";
- else
- $ssess = $sess;
-
- if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_CRIT) == 0)
- return;
- if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
- fwrite($fp, sprintf("CRIT: [%s] [%s] [%s]\n", $ssess, $PHP_SELF, $log));
- fclose($fp);
- }
+function log_only2($log)
+{
+ GLOBAL $sess, $PHP_SELF;
+
+ if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_ONL2) == 0)
+ return;
+
+ if (isset($sess) == FALSE)
+ $ssess = "XXXX";
+ else
+ $ssess = $sess;
+
+ if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_ONL2) == 0)
+ return;
+
+ $btrace = btrace_line(debug_backtrace());
+ if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
+ fwrite($fp, sprintf("ONL2: [%s] [%s] [%s]\n", $ssess, $log, $btrace));
+ fclose($fp);
+ }
}
-function log_only($log) {
- GLOBAL $sess, $PHP_SELF;
-
- if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_ONLY) == 0)
- return;
-
- if (isset($sess) == FALSE)
- $ssess = "XXXX";
- else
- $ssess = $sess;
-
- if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_ONLY) == 0)
- return;
-
- if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
- fwrite($fp, sprintf("ONLY: [%s] [%s] [%s]\n", $ssess, $PHP_SELF, $log));
- fclose($fp);
- }
+function log_crit($log)
+{
+ GLOBAL $sess, $PHP_SELF;
+
+ if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_CRIT) == 0)
+ return;
+
+ if (isset($sess) == FALSE)
+ $ssess = "XXXX";
+ else
+ $ssess = $sess;
+
+ if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_CRIT) == 0)
+ return;
+
+ $btrace = btrace_line(debug_backtrace());
+ if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
+ fwrite($fp, sprintf("CRIT: [%s] [%s] [%s]\n", $ssess, $log, $btrace));
+ fclose($fp);
+ }
}
-function log_main($log) {
+function log_only($log)
+{
GLOBAL $sess, $PHP_SELF;
-
- if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_MAIN) == 0)
- return;
-
- if (isset($sess) == FALSE)
- $ssess = "XXXX";
- else
- $ssess = $sess;
-
- if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_MAIN) == 0)
- return;
-
- if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
- fwrite($fp, sprintf("MAIN: [%s] [%s] [%s]\n", $ssess, $PHP_SELF, $log));
- fclose($fp);
- }
+
+ if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_ONLY) == 0)
+ return;
+
+ if (isset($sess) == FALSE)
+ $ssess = "XXXX";
+ else
+ $ssess = $sess;
+
+ if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_ONLY) == 0)
+ return;
+
+ $btrace = btrace_line(debug_backtrace());
+ if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
+ fwrite($fp, sprintf("ONLY: [%s] [%s] [%s]\n", $ssess, $log, $btrace));
+ fclose($fp);
+ }
}
-function log_rd($log) {
- GLOBAL $sess, $PHP_SELF;
-
- if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_READ) == 0)
- return;
-
- if (isset($sess) == FALSE)
- $ssess = "XXXX";
- else
- $ssess = $sess;
-
- if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_READ) == 0)
- return;
-
- if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
- fwrite($fp, sprintf("READ: [%s] [%s] [%s]\n", $ssess, $PHP_SELF, $log));
- fclose($fp);
- }
+function log_main($log)
+{
+ GLOBAL $sess, $PHP_SELF;
+
+ if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_MAIN) == 0)
+ return;
+
+ if (isset($sess) == FALSE)
+ $ssess = "XXXX";
+ else
+ $ssess = $sess;
+
+ if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_MAIN) == 0)
+ return;
+
+ $btrace = btrace_line(debug_backtrace());
+ if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
+ fwrite($fp, sprintf("MAIN: [%s] [%s] [%s]\n", $ssess, $log, $btrace));
+ fclose($fp);
+ }
}
-function log_rd2($log) {
- GLOBAL $sess, $PHP_SELF;
-
- if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_REA2) == 0)
- return;
-
- if (isset($sess) == FALSE)
- $ssess = "XXXX";
- else
- $ssess = $sess;
-
- if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_REA2) == 0)
- return;
-
- if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
- fwrite($fp, sprintf("REA2: [%s] [%s] [%s]\n", $ssess, $PHP_SELF, $log));
- fclose($fp);
- }
+function log_rd($log)
+{
+ GLOBAL $sess, $PHP_SELF;
+
+ if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_READ) == 0)
+ return;
+
+ if (isset($sess) == FALSE)
+ $ssess = "XXXX";
+ else
+ $ssess = $sess;
+
+ if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_READ) == 0)
+ return;
+
+ $btrace = btrace_line(debug_backtrace());
+ if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
+ fwrite($fp, sprintf("READ: [%s] [%s] [%s]\n", $ssess, $log, $btrace));
+ fclose($fp);
+ }
}
-function log_send($log) {
- GLOBAL $sess, $PHP_SELF;
-
- if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_SEND) == 0)
- return;
-
- if (isset($sess) == FALSE)
- $ssess = "XXXX";
- else
- $ssess = $sess;
-
- if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_SEND) == 0)
- return;
-
- if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
- fwrite($fp, sprintf("SEND: [%s] [%s] [%s]\n", $ssess, $PHP_SELF, $log));
- fclose($fp);
- }
+function log_rd2($log)
+{
+ GLOBAL $sess, $PHP_SELF;
+
+ if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_REA2) == 0)
+ return;
+
+ if (isset($sess) == FALSE)
+ $ssess = "XXXX";
+ else
+ $ssess = $sess;
+
+ if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_REA2) == 0)
+ return;
+
+ $btrace = btrace_line(debug_backtrace());
+
+ if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
+ fwrite($fp, sprintf("REA2: [%s] [%s] [%s]\n", $ssess, $log, $btrace));
+ fclose($fp);
+ }
}
-function log_lock($log) {
- GLOBAL $sess, $PHP_SELF;
-
- if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_LOCK) == 0)
- return;
-
- if (isset($sess) == FALSE)
- $ssess = "XXXX";
- else
- $ssess = $sess;
-
- if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_LOCK) == 0)
- return;
-
- if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
- fwrite($fp, sprintf("LOCK: [%s] [%s] [%s]\n", $ssess, $PHP_SELF, $log));
- fclose($fp);
- }
+function log_send($log)
+{
+ GLOBAL $sess, $PHP_SELF;
+
+ if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_SEND) == 0)
+ return;
+
+ if (isset($sess) == FALSE)
+ $ssess = "XXXX";
+ else
+ $ssess = $sess;
+
+ if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_SEND) == 0)
+ return;
+
+ $btrace = btrace_line(debug_backtrace());
+ if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
+ fwrite($fp, sprintf("SEND: [%s] [%s] [%s]\n", $ssess, $log, $btrace));
+ fclose($fp);
+ }
}
-function log_wr($log) {
- GLOBAL $sess, $PHP_SELF;
-
- if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_WRIT) == 0)
- return;
-
- if (isset($sess) == FALSE)
- $ssess = "XXXX";
- else
- $ssess = $sess;
-
- if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_WRIT) == 0)
- return;
-
- if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
- fwrite($fp, sprintf("WRIT: [%s] [%s] [%s]\n", $ssess, $PHP_SELF, $log));
- fclose($fp);
- }
+function log_lock($log)
+{
+ GLOBAL $sess, $PHP_SELF;
+
+ if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_LOCK) == 0)
+ return;
+
+ if (isset($sess) == FALSE)
+ $ssess = "XXXX";
+ else
+ $ssess = $sess;
+
+ if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_LOCK) == 0)
+ return;
+
+ $btrace = btrace_line(debug_backtrace());
+ if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
+ fwrite($fp, sprintf("LOCK: [%s] [%s] [%s]\n", $ssess, $log, $btrace));
+ fclose($fp);
+ }
}
-function log_load($log) {
- GLOBAL $sess, $PHP_SELF;
-
- if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_LOAD) == 0)
- return;
-
- if (isset($sess) == FALSE)
- $ssess = "XXXX";
- else
- $ssess = $sess;
+function log_wr($log)
+{
+ GLOBAL $sess, $PHP_SELF;
+
+ if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_WRIT) == 0)
+ return;
+
+ if (isset($sess) == FALSE)
+ $ssess = "XXXX";
+ else
+ $ssess = $sess;
+
+ if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_WRIT) == 0)
+ return;
+
+ $btrace = btrace_line(debug_backtrace());
+ if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
+ fwrite($fp, sprintf("WRIT: [%s] [%s] [%s]\n", $ssess, $log, $btrace));
+ fclose($fp);
+ }
+}
- if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_LOAD) == 0)
- return;
-
- if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
- fwrite($fp, sprintf("LOAD: [%s] [%s] [%s]\n", $ssess, $PHP_SELF, $log));
- fclose($fp);
- }
+function log_load($log)
+{
+ GLOBAL $sess, $PHP_SELF;
+
+ if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_LOAD) == 0)
+ return;
+
+ if (isset($sess) == FALSE)
+ $ssess = "XXXX";
+ else
+ $ssess = $sess;
+
+ if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_LOAD) == 0)
+ return;
+
+ $btrace = btrace_line(debug_backtrace());
+ if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
+ fwrite($fp, sprintf("LOAD: [%s] [%s] [%s]\n", $ssess, $log, $btrace));
+ fclose($fp);
+ }
}
-function log_auth($sess, $log) {
+function log_auth($sess, $log)
+{
GLOBAL $PHP_SELF;
- if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_AUTH) == 0)
- return;
-
- if (( (BRISK_DEBUG | ($sess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_AUTH) == 0)
- return;
- if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
- fwrite($fp, sprintf("AUTH: [%s] [%d] [%s] [%s]\n", $sess, time(), $PHP_SELF, $log));
- fclose($fp);
- }
+ if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_AUTH) == 0)
+ return;
+
+ if (( (BRISK_DEBUG | ($sess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_AUTH) == 0)
+ return;
+
+ $btrace = btrace_line(debug_backtrace());
+ if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
+ fwrite($fp, sprintf("LOAD: [%s] [%d] [%s] [%s]\n", $sess, time(), $log, $btrace));
+ fclose($fp);
+ }
}