- // $("xhrlog").innerHTML += "CHECK COM<br>";
- // extracts the new part of the command string
- comm_newpart = xhr_rd_newctx.substr(delta);
-
- // XX $("xhrlog").innerHTML = xhr_rd_newctx.replace("<", "<", "g");
-
- // $("response").innerHTML = comm_newpart;
- comm_match = /_*@BEGIN@(.*?)@END@/g;
- comm_clean = /_*@BEGIN@(.*?)@END@/;
- comm_len = 0;
- comm_arr = comm_newpart.match(comm_match);
-
- // $("sandbox").innerHTML += "PRE COMMARR<br>";
- if (comm_arr) {
- // XX $("xhrdeltalog").innerHTML += "DELTA: "+delta +"<br>";
- // XX alert("xhr_rd_newctx: "+xhr_rd_newctx);
- // $("sandbox").innerHTML += "POST COMMARR<br>";
- for (i = 0 ; i < comm_arr.length ; i++) {
- var temp = comm_arr[i].replace(comm_clean,"$1").split("|");
- gst.comms = gst.comms.concat(temp);
- // XX alert("COMM_ARR["+i+"]: "+comm_arr[i]+" LEN:"+comm_arr[i].length);
- comm_len += comm_arr[i].length;
+ this.xhr_rd_delayed = setTimeout(
+ function(f_obj, f_sess, f_stat, f_subst, f_step){ f_obj.xhr_rd_start(f_sess, f_stat, f_subst, f_step); },
+ this.xhr_rd_delay, this, sess, stat, subst, gst.st);
+ // console.log("XXX DI QUI post"+this.xhr_rd_delayed);
+ }
+ }
+ else {
+ // console.log("yyy DI QUI "+this.xhr_rd_delay);
+ this.xhr_rd_start(sess, stat, subst, gst.st);
+ }
+ }
+
+
+ // $("sandbox").innerHTML += "return 1<br>";
+ if (this.the_end != true) {
+ this.watchdog = 0;
+ setTimeout(function(obj, sess){ obj.xhr_rd_poll(sess); }, tout, this, sess);
+
+ // this.hbit(".");
+
+ }
+ else {
+ //x alert("the_end2");
+ if (this.xhr_rd_watchdog != null) {
+ clearTimeout(this.xhr_rd_watchdog);
+ this.xhr_rd_watchdog = null;
+ }
+ }
+ return;
+ }
+
+
+ // no new char from the last loop, break
+ if (this.xhr_rd_old_n == this.xhr_rd_cur_n &&
+ this.xhr_rd_newctx.length == this.xhr_rd_checkedlen) {
+ this.watchdog++;
+ break;
+ }
+ else {
+ // $("sandbox").innerHTML += "BIG IF<br>";
+ var comm_match;
+ var comm_clean;
+ var comm_len;
+ var comm_newpart;
+ var comm_arr;
+ var i;
+ var delta = 0;
+ var match_lines = /^_*$/;
+
+ this.watchdog = 0;
+ this.hbit("/\\");
+
+ // check for the same command group
+ if (this.xhr_rd_old_n != this.xhr_rd_cur_n) {
+ this.xhr_rd_old_n = this.xhr_rd_cur_n;
+ this.xhr_rd_checkedlen = 0;
+ this.xhr_rd_oldctx = "";