From: Matteo Nastasi (mop) Date: Wed, 25 Apr 2012 14:50:25 +0000 (+0200) Subject: fixed trivial conflicts X-Git-Url: https://mop.ddnsfree.com/gitweb/?p=xynt.git;a=commitdiff_plain;h=e34d9bc4d332a1421383cc4614b5e461ef207dfa;hp=386fa94983dde1a403adc18267ebe1865e65def5 fixed trivial conflicts --- diff --git a/web/test-hs-rd.php b/web/test-hs-rd.php index d9a0867..95aa3df 100644 --- a/web/test-hs-rd.php +++ b/web/test-hs-rd.php @@ -1,47 +1,125 @@ - + \n"); + mop_flush(); $to = rand(10,20); for ($first = true, $i = $st+1 ; $i < $st+$to ; $i++, $first = false) { - // if ($i == 0) - // sleep(1); - - if ($i != 8 || true) { + if ($i == 8 /*+$st*/) { + // exit(); + if ($first == true) { + sleep(5); + } + else { + // exit(); + sleep(30); + } + } + + if ($i > 10 && $i < 20) { printf("", $i, ($first ? "
" : ""), $i, $i); +push(null); +", $i, $i); } else { - // exit(); - // sleep(30); + printf("", $i, ($first ? "
" : ""), $i, $i); } - if ($first) - printf("", $s); + mop_flush(); usleep(1000000); } diff --git a/web/xynt/xynt-commons.js b/web/xynt/xynt-commons.js index 9af0555..550cc28 100644 --- a/web/xynt/xynt-commons.js +++ b/web/xynt/xynt-commons.js @@ -210,4 +210,4 @@ function url_complete(parent, url) else { return (host+path+url); } -} \ No newline at end of file +} diff --git a/web/xynt/xynt-http-streaming.js b/web/xynt/xynt-http-streaming.js index a9ccdcd..f6b0a0b 100644 --- a/web/xynt/xynt-http-streaming.js +++ b/web/xynt/xynt-http-streaming.js @@ -60,7 +60,6 @@ http_streaming.prototype = { cmdproc: null, comm_match: /_*@BEGIN@(.*?)@END@/g, comm_clean: /_*@BEGIN@(.*?)@END@/, - ctx_old: "", ctx_old_len: 0, // ctx_new: "", ctx_new_len: 0, @@ -74,8 +73,10 @@ http_streaming.prototype = { this.doc.body.appendChild(this.ifra); if (page != null) this.page = url_complete(this.win.location.href, page); - this.page = url_append_args(this.page, "sess", this.sess, "st", gst.st); - // this.log("http_streaming::start:this.page "+this.page); + this.page = url_append_args(this.page, "sess", this.sess, "st", this.gst.st); + this.log(this.page); + + // this.log(this.ifra); this.ifra.contentWindow.location.href = this.page; this.watchdog_ct = 0; this.watchdog_hdl = setTimeout(function(obj) { obj.log("tout1"); obj.watchdog(); }, this.watchdog_timeout, this); @@ -84,10 +85,11 @@ http_streaming.prototype = { watchdog: function () { var i, again; var comm_newpart, comm_len, comm_arr; + var ctx_new_len; // WATCHDOGING THE CONNECTION + this.log("hs::watchdog: start, cur equal times: "+this.keepalives_equal); if ( (this.watchdog_ct % this.watchdog_checktm) == 0 || !this.watchable) { - this.log("hs::watchdog: start, cur equal times: "+this.keepalives_equal); if (!this.watchable) { do { if (typeof(this.ifra.contentWindow.http_streaming) == 'undefined') @@ -125,21 +127,30 @@ http_streaming.prototype = { again = 0; if (typeof(this.ifra.contentWindow.ctx_new) == 'undefined') break; - if (this.ifra.contentWindow.ctx_new.length == this.ctx_old_len) { - // this.ctx_new = this.ctx_old = ""; - // FIXME find a more robust clean method + + ctx_new_length = this.ifra.contentWindow.ctx_new.length; + if (ctx_new_length == this.ctx_old_len) { break; } - this.log("new: "+ this.ifra.contentWindow.ctx_new.length + " old: "+this.ctx_old_len); + this.log("new: "+ ctx_new_length + " old: "+this.ctx_old_len); this.keepalive_new++; - for (i = this.ctx_old_len ; i < this.ifra.contentWindow.ctx_new.length ; i++) { - if (this.ifra.contentWindow.ctx_new[i] != '_') + for (i = this.ctx_old_len ; i < ctx_new_length ; i++) { + if (this.ifra.contentWindow.ctx_new.charAt(i) != '_') { + this.log("ctx_new.char(i) != '_' ["+this.ifra.contentWindow.ctx_new.charAt(i)+"]"); break; + } + else { + this.log("ctx_new.charAt(i) == '_'"); + } } - if (i == this.ifra.contentWindow.ctx_new.length) { - this.ctx_old_len = i; + this.ctx_old_len = i; + if (i == ctx_new_length) { + this.log("old_len == i"); break; } + else { + this.log("old_len != i: "+i); + } comm_newpart = this.ifra.contentWindow.ctx_new.substr(this.ctx_old_len); comm_len = 0; comm_arr = comm_newpart.match(this.comm_match); @@ -152,10 +163,9 @@ http_streaming.prototype = { // XX alert("COMM_ARR["+i+"]: "+comm_arr[i]+" LEN:"+comm_arr[i].length); comm_len += comm_arr[i].length; } - this.ctx_old += comm_newpart.substr(0,comm_len); again = 1; } - this.ctx_old_len = this.ctx_old.length; + this.ctx_old_len += comm_len; } while (again); @@ -216,7 +226,6 @@ http_streaming.prototype = { delete this.ifra; this.ifra = null; } - this.ctx_old = ""; this.ctx_old_len = 0; },