define(DBG_AUTH, 0x0200);
define(DBG_CRIT, 0x0400);
define(DBG_LMOP, 0x0800);
-
+define(DBG_TRAC, 0x1000);
// NOTE: BRISK DEBUG must be a numerical constant, not the result of operations on symbols
define(BRISK_DEBUG, 0xffffffbf);
}
+class Vect {
+ function Vect($a)
+ {
+ $this->el = $a;
+ }
+
+ function getbyid($idx)
+ {
+ return ($this->el[$idx]);
+ }
+
+ function setbyid($idx, $v)
+ {
+ $this->el[$idx] = $v;
+ }
+}
+
class Table {
var $idx;
var $player;
class Room {
+ static $delta_t;
+
var $user;
var $table;
var $comm; // commands for many people
if (($res = sem_get($tok)) == FALSE) {
return (FALSE);
}
- if (sem_acquire($res)) {
- log_lock("LOCK room");
+ if (sem_acquire($res)) {
+ self::$delta_t = microtime(TRUE);
+ log_lock("LOCK room [".self::$delta_t."]");
+
return ($res);
}
else
{
GLOBAL $sess;
- log_lock("UNLOCK room");
+ log_lock("UNLOCK room [".(microtime(TRUE) - (self::$delta_t))."]");
return (sem_release($res));
}
if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_LMOP) == 0)
return;
- $btrace = btrace_line(debug_backtrace());
+ if (BRISK_DEBUG & DBG_TRAC)
+ $btrace = btrace_line(debug_backtrace());
+ else
+ $btrace = "";
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);
if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_ONL2) == 0)
return;
- $btrace = btrace_line(debug_backtrace());
+ if (BRISK_DEBUG & DBG_TRAC)
+ $btrace = btrace_line(debug_backtrace());
+ else
+ $btrace = "";
if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
fwrite($fp, sprintf("ONL2: [%s] [%s] [%s]\n", $ssess, $log, $btrace));
fclose($fp);
if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_CRIT) == 0)
return;
- $btrace = btrace_line(debug_backtrace());
+ if (BRISK_DEBUG & DBG_TRAC)
+ $btrace = btrace_line(debug_backtrace());
+ else
+ $btrace = "";
if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
fwrite($fp, sprintf("CRIT: [%s] [%s] [%s]\n", $ssess, $log, $btrace));
fclose($fp);
if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_ONLY) == 0)
return;
- $btrace = btrace_line(debug_backtrace());
+ if (BRISK_DEBUG & DBG_TRAC)
+ $btrace = btrace_line(debug_backtrace());
+ else
+ $btrace = "";
if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
fwrite($fp, sprintf("ONLY: [%s] [%s] [%s]\n", $ssess, $log, $btrace));
fclose($fp);
if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_MAIN) == 0)
return;
- $btrace = btrace_line(debug_backtrace());
+ if (BRISK_DEBUG & DBG_TRAC)
+ $btrace = btrace_line(debug_backtrace());
+ else
+ $btrace = "";
if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
fwrite($fp, sprintf("MAIN: [%s] [%s] [%s]\n", $ssess, $log, $btrace));
fclose($fp);
if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_READ) == 0)
return;
-
- $btrace = btrace_line(debug_backtrace());
+
+ if (BRISK_DEBUG & DBG_TRAC)
+ $btrace = btrace_line(debug_backtrace());
+ else
+ $btrace = "";
if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
fwrite($fp, sprintf("READ: [%s] [%s] [%s]\n", $ssess, $log, $btrace));
fclose($fp);
if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_REA2) == 0)
return;
- $btrace = btrace_line(debug_backtrace());
+ if (BRISK_DEBUG & DBG_TRAC)
+ $btrace = btrace_line(debug_backtrace());
+ else
+ $btrace = "";
if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
fwrite($fp, sprintf("REA2: [%s] [%s] [%s]\n", $ssess, $log, $btrace));
if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_SEND) == 0)
return;
- $btrace = btrace_line(debug_backtrace());
+ if (BRISK_DEBUG & DBG_TRAC)
+ $btrace = btrace_line(debug_backtrace());
+ else
+ $btrace = "";
if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
fwrite($fp, sprintf("SEND: [%s] [%s] [%s]\n", $ssess, $log, $btrace));
fclose($fp);
if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_LOCK) == 0)
return;
- $btrace = btrace_line(debug_backtrace());
+ if (BRISK_DEBUG & DBG_TRAC)
+ $btrace = btrace_line(debug_backtrace());
+ else
+ $btrace = "";
if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
fwrite($fp, sprintf("LOCK: [%s] [%s] [%s]\n", $ssess, $log, $btrace));
fclose($fp);
if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_WRIT) == 0)
return;
- $btrace = btrace_line(debug_backtrace());
+ if (BRISK_DEBUG & DBG_TRAC)
+ $btrace = btrace_line(debug_backtrace());
+ else
+ $btrace = "";
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;
- $btrace = btrace_line(debug_backtrace());
+ if (BRISK_DEBUG & DBG_TRAC)
+ $btrace = btrace_line(debug_backtrace());
+ else
+ $btrace = "";
if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
fwrite($fp, sprintf("LOAD: [%s] [%s] [%s]\n", $ssess, $log, $btrace));
fclose($fp);
if (( (BRISK_DEBUG | ($sess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_AUTH) == 0)
return;
- $btrace = btrace_line(debug_backtrace());
+ if (BRISK_DEBUG & DBG_TRAC)
+ $btrace = btrace_line(debug_backtrace());
+ else
+ $btrace = "";
if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) {
fwrite($fp, sprintf("LOAD: [%s] [%d] [%s] [%s]\n", $sess, time(), $log, $btrace));
fclose($fp);
}
}
-
-function lock_banlist()
-{
- if (($tok = @ftok(FTOK_PATH."/main", "L")) == -1) {
- echo "FTOK FAILED";
- exit;
- }
- if (($res = sem_get($tok)) == FALSE) {
- echo "SEM_GET FAILED";
- exit;
- }
- if (sem_acquire($res))
- return ($res);
- else
- return (FALSE);
-}
-
-function unlock_banlist($res)
-{
- return (sem_release($res));
-}
-
function table_act_content($isstanding, $sitted, $table, $cur_table, $allowed)
{
$ret = "";
}
class Warrant {
+ static $delta_t;
+
function lock_data()
{
GLOBAL $sess;
return (FALSE);
}
if (sem_acquire($res)) {
- log_lock("LOCK warrant");
+ self::$delta_t = microtime(TRUE);
+ log_lock("LOCK warrant [".self::$delta_t."]");
return ($res);
}
else
{
GLOBAL $sess;
- log_lock("UNLOCK warrant");
-
+ log_lock("UNLOCK warrant [".(microtime(TRUE) - (self::$delta_t))."]");
+
return (sem_release($res));
}
}
class Poll {
+ static $delta_t;
+
function lock_data()
{
GLOBAL $sess;
if (($res = sem_get($tok)) == FALSE) {
return (FALSE);
}
- if (sem_acquire($res)) {
- log_lock("LOCK poll");
- return ($res);
+ if (sem_acquire($res)) {
+ self::$delta_t = microtime(TRUE);
+ log_lock("LOCK poll [".self::$delta_t."]");
+
+ return ($res);
}
else
return (FALSE);
{
GLOBAL $sess;
- log_lock("UNLOCK poll");
+ log_lock("UNLOCK poll [".(microtime(TRUE) - (self::$delta_t))."]");
return (sem_release($res));
}