define('LOCK_SHARE_MAX', 10000);
-define('DBG_ONL2', 0x0001);
-define('DBG_ONLY', 0x0002);
-define('DBG_MAIN', 0x0004);
-define('DBG_READ', 0x0008);
-define('DBG_REA2', 0x0010);
-define('DBG_SEND', 0x0020);
-define('DBG_LOCK', 0x0040);
-define('DBG_WRIT', 0x0080);
-define('DBG_LOAD', 0x0100);
-define('DBG_AUTH', 0x0200);
-define('DBG_CRIT', 0x0400);
-define('DBG_LMOP', 0x0800);
-define('DBG_TRAC', 0x1000);
-define('DBG_SHME', 0x2000);
-define('DBG_ENGI', 0x4000);
-define('DBG_CDS', 0x8000);
+define('DBG_ONL2', 0x000001);
+define('DBG_ONLY', 0x000002);
+define('DBG_MAIN', 0x000004);
+define('DBG_READ', 0x000008);
+define('DBG_REA2', 0x000010);
+define('DBG_SEND', 0x000020);
+define('DBG_LOCK', 0x000040);
+define('DBG_WRIT', 0x000080);
+define('DBG_LOAD', 0x000100);
+define('DBG_AUTH', 0x000200);
+define('DBG_CRIT', 0x000400);
+define('DBG_LMOP', 0x000800);
+define('DBG_TRAC', 0x001000);
+define('DBG_SHME', 0x002000);
+define('DBG_ENGI', 0x004000);
+define('DBG_CDS', 0x008000);
+define('DBG_STEP', 0x010000);
// NOTE: BRISK DEBUG must be a numerical constant, not the result of operations on symbols
define('BRISK_DEBUG', 0x0800);
}
}
+function log_step($log)
+{
+ GLOBAL $PHP_SELF;
+
+ if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_STEP) == 0)
+ return;
+
+ $sess = Brisk::sess_cur_get();
+ if (isset($sess) == FALSE)
+ $ssess = "XXXX";
+ else
+ $ssess = $sess;
+
+ if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_STEP) == 0)
+ return;
+
+ if ((BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_TRAC)
+ $btrace = btrace_line(debug_backtrace());
+ else
+ $btrace = "";
+ if (($fp = @fopen(LEGAL_PATH."/step.log", 'a')) != FALSE) {
+ fwrite($fp, sprintf("STEP: [%f] [%s] [%s]\n", gettimeofday(TRUE), $log, $btrace));
+ fclose($fp);
+ }
+}
+
+
function log_cds($log)
{
var $subst; // substatus for each status
var $step; // step of the current status
var $trans_step; // step to enable transition between pages (disable == -1)
+ var $cl_step; // current step returned by client
var $rd_socket; // socket handle of push stream
var $rd_endtime; // end time for push stream
$thiz->subst = $subst;
$thiz->step = 1;
$thiz->trans_step = -1;
+ $thiz->cl_step = -1;
$thiz->comm = array();
$thiz->rd_socket = NULL;
$this->subst = $from->subst;
$this->step = $from->step;
$this->trans_step = $from->trans_step;
+ $this->cl_step = $from->cl_step;
$this->comm = array();
$i_start = (1 > ($from->step - COMM_N) ? 1 : ($from->step - COMM_N));
$thiz->subst = $from->subst;
$thiz->step = $from->step;
$thiz->trans_step = $from->trans_step;
+ $thiz->cl_step = $from->cl_step;
$thiz->comm = array();
/*
$ret = FALSE;
$curtime = time();
-
+
/* Nothing changed, return. */
if ($this->rd_step == $this->step)
return (FALSE);
log_load("index_wr.php");
$remote_addr = addrtoipv4($remote_addr_full);
- if (($mesg = gpcs_var('mesg', $get, $post, $cookie)) === FALSE)
+ if (($mesg = gpcs_var('mesg', $get, $post, $cookie)) === FALSE)
unset($mesg);
+ if (($cl_step = gpcs_var('stp', $get, NULL, NULL)) === FALSE)
+ $cl_step = -2;
+
if (($sess = gpcs_var('sess', $get, $post, $cookie)) === FALSE)
$sess = "";
// LACC UPDATED
$user->lacc = $curtime;
+ if ($user->cl_step < $cl_step) {
+ log_step(sprintf("%s|%s|%d|%d|%d|%d", $user->sess, $user->name, $user->step, $user->cl_step, $cl_step, $user->step - $user->cl_step));
+ $user->cl_step = $cl_step;
+ }
if ( ( ! $user->is_auth() ) &&
$brisk->ban_check($user->ip)) {