no_cache management added
authorMatteo Nastasi (mop) <nastasi@alternativeoutput.com>
Wed, 3 Oct 2012 20:13:11 +0000 (22:13 +0200)
committerMatteo Nastasi (mop) <nastasi@alternativeoutput.com>
Wed, 3 Oct 2012 20:13:11 +0000 (22:13 +0200)
web/Obj/brisk.phh
web/Obj/sac-a-push.phh
web/briskin5/Obj/briskin5.phh
web/commons.js
web/xynt-http-streaming.js

index b52c333..af2a901 100644 (file)
@@ -293,6 +293,13 @@ function mop_flush()
     flush();
 }
 
+function force_no_cache(&$header_out)
+{
+    $header_out['Pragma'] = 'no-cache, must-revalidate';
+    $header_out['Cache-Control'] = 'no-cache';
+    $header_out['Expires'] = '-1';
+}
+
 function file_lock($fname, $is_exclusive)
 {
     if (($res = @fopen($fname, "r+")) == FALSE) {
@@ -2179,6 +2186,8 @@ class Room {
       $content = ob_get_contents();
       ob_end_clean();
 
+      force_no_cache($header_out);
+
       $s_a_p->pgflush_try_add($new_socket, 20, $header_out, $content);
       return TRUE;
 
@@ -2189,6 +2198,8 @@ class Room {
           $content = ob_get_contents();
           ob_end_clean();
 
+          force_no_cache($header_out);
+
           $s_a_p->pgflush_try_add($new_socket, 20, $header_out, $content);
           return TRUE;
 
index 4a325da..e57879f 100644 (file)
@@ -284,7 +284,7 @@ class Sac_a_push {
             }
             $write  = NULL;
             $except = NULL;
-            $num_changed_sockets = stream_select($read, $write, $except, 0, 250000);
+            $num_changed_sockets = stream_select($read, $write, $except, 5, 0);
         
             if ($num_changed_sockets == 0) {
                 printf(" no data in 5 secs ");
index 2bdb236..f4e266d 100644 (file)
@@ -747,6 +747,8 @@ class Bin5 {
             $content = ob_get_contents();
             ob_end_clean();
             
+            force_no_cache($header_out);
+
             $pgflush = new PageFlush($new_socket, $curtime, 20, $header_out, $content);
             
             if ($pgflush->try_flush($curtime) == FALSE) {
@@ -1269,6 +1271,8 @@ class Bin5 {
             $content = ob_get_contents();
             ob_end_clean();
         
+            force_no_cache($header_out);
+
             $s_a_p->pgflush_try_add($new_socket, 20, $header_out, $content);
             return TRUE;
         
@@ -1280,6 +1284,8 @@ class Bin5 {
             $content = ob_get_contents();
             ob_end_clean();
             
+            force_no_cache($header_out);
+
             $s_a_p->pgflush_try_add($new_socket, 20, $header_out, $content);
             return TRUE;
             
index f0ea078..99a2983 100644 (file)
@@ -249,6 +249,7 @@ function send_mesg(mesg)
     
     // alert("xhr_wr: "+xhr_wr+"  is_conn: "+is_conn);
     xhr_wr.open('GET', 'index_wr.php?'+(is_conn ? 'sess='+sess+'&' : '')+'mesg='+mesg, (is_conn ? true : false));
+    xhr_wr.setRequestHeader("If-Modified-Since", new Date().toUTCString());
     xhr_wr.onreadystatechange = function() { return; };
     if (typeof(g_debug) == 'number' && g_debug > 0
         && typeof(console) == 'object' && typeof(console.log) == 'function') {
index 0cbf36b..7d216aa 100644 (file)
@@ -39,7 +39,8 @@ http_streaming.prototype = {
     keepalives_equal:  0,
     keepalives_eq_max: 6,
     /* NOTE: right watch_timeout value to 100, for devel reasons use 1000 or more */
-    watchdog_timeout:  200,
+    // FIXME watchdog_timeout:  200,
+    watchdog_timeout:  2000,
     watchdog_ct:       0,
     watchdog_checktm:  20,
     watchable:         false,