ctx_new moved and $st added to manage status value
authorMatteo Nastasi (mop) <nastasi@alternativeoutput.com>
Wed, 25 Apr 2012 08:54:02 +0000 (10:54 +0200)
committerMatteo Nastasi (mop) <nastasi@alternativeoutput.com>
Wed, 25 Apr 2012 08:54:02 +0000 (10:54 +0200)
web/test-hs-rd.php
web/xynt/xynt-http-streaming-ifra.js

index b3030dd..bd4667e 100644 (file)
@@ -4,7 +4,6 @@
 <script type="text/javascript" src="xynt/xynt-http-streaming-ifra.js"></script>
 <script type="text/javascript">
 var http_streaming = "ready";
-var ctx_new = "";
 
 window.onload = function () { if (http_streaming != "ready") http_streaming.reload(); };
 </script> 
@@ -20,6 +19,7 @@ function mop_flush()
 
 function main()
 {
+    $st = 0;
     $fp = fopen("/tmp/test-hs-rd.log", "a");
     fwrite($fp, "START\n");
     fclose($fp);
@@ -28,19 +28,21 @@ function main()
     for ($i = 0 ; $i < 4096 ; $i++) {
         $s .= rand(65,90);
     }
-    for ($i = 0 ; $i < 15 ; $i++) {
+
+    $to = rand(10,20);
+    for ($first = true, $i = $st+1 ; $i < $st+$to ; $i++, $first = false) {
         // if ($i == 0)
         //    sleep(1);
      
-        if ($i == 8) {
+        if ($i == $st+8) {
             // exit();
             sleep(30);
         }
         printf("<script id='hs%d' type='text/javascript'>
 push(\"$('cont').innerHTML += '%s %d';\");
-</script>", $i, ($i == 0 ? "<br/>" : ""), $i);
+</script>", $i, ($first ? "<br/>" : ""), $i);
 
-        if ($i == 0)
+        if ($first)
             printf("<!-- %s -->", $s);
         mop_flush();
         usleep(1000000);
index a854c05..7b4124f 100644 (file)
@@ -1,3 +1,5 @@
+var ctx_new = "";
+
 function push(s) {
     if (s != null) {
         ctx_new += "@BEGIN@"+s+"@END@";