TODO |
------+
+page_id =>
+ - add page_id to both index.php pages (WIP)
+ DONE - add page_id to user class
+ DONE - pass page_id to transport (WIP)
+ - manage server-side page_id in transport channel
+ - manage index_rd
+ - manage page to stop transport retry
+
+
BUGS |
------+
- manage client answer (ping) on closing ws
do {
if (!isset($cookie['sess'])
|| (($user = $this->get_user($cookie['sess'], $idx)) == FALSE)) {
-
- $content = User::stream_fini($transp, $s_a_p->rndstr, TRUE);
+ // || (($user = $this->get_user($cookie['sess'], $idx)) == FALSE)
+ // || $user->page_id != $get['page_id']) {
+ $content = "";
+ // if ($user->page_id != $get['page_id']) {
+ // $content .= "OLD_PAGE";
+ // }
+ printf("\ndiscarded here\n");
+ printf("Is Cookie %s\n", (isset($cookie['sess']) ? TRUE : FALSE));
+ $content .= User::stream_fini($transp, $s_a_p->rndstr, TRUE);
$s_a_p->pendpage_try_addflush($new_socket, 20, $enc, $header_out, $content);
return TRUE;
break;
- }
- $this->sess_cur_set($user->sess);
+ }
+ $this->sess_cur_set($user->sess);
// close a previous opened index_read_ifra socket, if exists
if (($prev = $user->rd_socket_get()) != NULL) {
$s_a_p->socks_unset($user->rd_socket_get());
var $code; // authentication code
var $name; // name of the user
var $sess; // session of the user
+ var $page_id; // id of the latest page connected with this session
var $ip; // ip of the user
var $lacc; // last access (for the cleanup)
var $laccwr; // last access (for the cleanup)
function User() {
}
- static function create(&$brisk, $idx, $name, $sess, $stat = "", $subst = "", $table = -1, $ip="0.0.0.0") {
+ static function create(&$brisk, $idx, $name, $sess, $page_id="", $stat = "", $subst = "", $table = -1, $ip="0.0.0.0") {
if (($thiz = new User()) == FALSE)
return (FALSE);
$thiz->code = -1;
$thiz->name = $name;
$thiz->sess = $sess;
+ $thiz->page_id = $page_id;
$thiz->ip = $ip;
$thiz->lacc = time();
$thiz->laccwr = time();
$this->code = $from->code;
$this->name = $from->name;
$this->sess = $from->sess;
+ $this->page_id = $from->page_id;
$this->ip = $from->ip;
$this->lacc = $from->lacc;
$this->laccwr = $from->laccwr;
$thiz->code = $from->code;
$thiz->name = $from->name;
$thiz->sess = $from->sess;
+ $thiz->page_id = $from->page_id;
$thiz->ip = $from->ip;
$thiz->lacc = $from->lacc;
$thiz->laccwr = $from->laccwr;
$tmp_sess = $this->sess;
$this->sess = "";
+ $this->page_id = "";
self::unproxy_step($tmp_sess);
$this->name = ""; // OK here
while (array_pop($this->comm) != NULL);
}
}
}
+
+ if ($ACTION == "room") {
+ /* shutdown any previous transport socket */
+ $user->page_id = md5(microtime().$remote_addr_full);
+ // $brisk->abort_old_sockets($user);
+ }
+
/* Rendering. */
if ($BRISK_SHOWHTML == "debugtable") {
var $$ = jQuery.noConflict();
var sess = "not_connected";
+ var page_id = "<? echo $user->page_id; ?>";
var g_debug = 0;
var g_lang = "<? echo $G_lang; ?>";
var g_lng = "<? echo $G_lng; ?>";
var spo_slide, sup_slide;
window.onload = function() {
- g_brow = get_browser_agent();
+ if ('localStorage' in window) {
+ var v_name = cookiepath.replace(/\//g, '') + '_index_page_id';
+ var local_page_id = window.localStorage.getItem(v_name);
+ if (local_page_id == page_id) {
+ window.location.reload();
+ }
+ else {
+ window.localStorage.setItem(v_name, page_id);
+ }
+ }
+
+ g_brow = get_browser_agent();
- g_prefs = new client_prefs(null);
+ g_prefs = new client_prefs(null);
- spo_slide = new sideslide($('spon_caro'), 80, 20);
- sup_slide = new sideslide($('supp_caro'), 80, 20);
+ spo_slide = new sideslide($('spon_caro'), 80, 20);
+ sup_slide = new sideslide($('supp_caro'), 80, 20);
<?php
if ($BRISK_SHOWHTML == "debugtable") {
sidebanners_init($G_sidebanner_idx);
?>
sess = "<?php echo "$sess"; ?>";
- xstm = new xynt_streaming(window, <?php printf("\"%s\", %d", $transp_type, $transp_port); ?>, 2, null /* console */, gst, 'index_php', 'sess', sess, $('sandbox'), 'index_rd.php', function(com){eval(com);});
+ xstm = new xynt_streaming(window, <?php printf("\"%s\", %d", $transp_type, $transp_port); ?>, 2, null /* console */, gst,
+ 'index_php', 'sess', sess, $('sandbox'), 'index_rd.php', page_id, function(com){eval(com);});
xstm.hbit_set(heartbit);
tra = new train($('room_tit'));
window.onunload = onunload_cb;
}
}
-function xynt_streaming(win, transp_type, transp_port, transp_fback, console, gst, from, cookiename, sess, sandbox, page, cmdproc)
+function xynt_streaming(win, transp_type, transp_port, transp_fback, console, gst, from, cookiename, sess, sandbox, page, page_id, cmdproc)
{
this.win = win;
this.transp_type = transp_type;
this.sess = sess;
this.sandbox = sandbox;
this.page = page;
+ this.page_id = page_id;
this.cmdproc = cmdproc;
// this.cmdproc = function(com){/* console.log("COM: "+com); */ eval(com);}
this.doc = win.document;
sess: null,
sandbox: null,
page: null,
+ page_id: null,
cmdproc: null,
start_time: 0,
}
// stat, subst, this.gst.st
- page = url_append_args(page, "sess", this.sess, "stat", stat, "subst", subst, "step", this.gst.st, "from", this.from);
+ page = url_append_args(page, "sess", this.sess, "page_id", this.page_id, "stat", stat, "subst", subst, "step", this.gst.st, "from", this.from);
// this.log("the page:");
// this.log(page);