reduced log nginx
authorMatteo Nastasi <nastasi@alternativeoutput.it>
Tue, 17 Mar 2020 06:10:41 +0000 (07:10 +0100)
committerMatteo Nastasi <nastasi@alternativeoutput.it>
Tue, 17 Mar 2020 06:11:21 +0000 (07:11 +0100)
web/Obj/brisk.phh
web/Obj/hardban.phh
web/Obj/provider_proxy.phh
web/Obj/sac-a-push.phh
web/Obj/user.phh
web/briskin5/Obj/briskin5.phh
web/commons.js
web/index.php
web/index_wr.php
web/spush/brisk-spush.phh

index 5bf51e1..68e0418 100644 (file)
@@ -59,7 +59,7 @@ define('EXPIRE_TIME_SMAMMA', 360);
 define('EXPIRE_TIME_WAG', 10);
 define('WAKEUP_TIME', 12);
 // BAN_TIME da allineare anche in commons.js
-define('BAN_TIME', 3600);
+define('BAN_TIME', 900);
 define('GARBAGE_TIMEOUT', 5);
 define('NICKSERV', "BriskServ");
 
@@ -153,7 +153,7 @@ $mlang_brisk = array( 'btn_backstand'=> array( 'it' => 'torna in piedi',
 $G_lng = langtolng($G_lang);
 
 $G_all_points = array( 11,10,4,3,2, 0,0,0,0,0 );
-$G_brisk_version = "5.4.2";
+$G_brisk_version = "5.5.0";
 
 /* MLANG: ALL THE INFO STRINGS IN brisk.phh */
 $root_wellarr = array( 'it' => array ( 'Brisk (Ver. '.$G_brisk_version.'), <b>NOVITA\'</b>: uscita più veloce dal sito.',
@@ -183,7 +183,7 @@ Durante la partita, se vorrete ricaricare la pagina, usate l\'apposito bottone \
 Dopo che &egrave; iniziata una partita per uscirne dovete chiedere agli altri giocatori di sbloccarla cliccando sul lucchetto. Se non si segue questa prassi, una volta usciti, non vi potrete sedere a nessun tavolo per '.floor(BAN_TIME/60).' minuti.
 <dl>
 <dt><b>Comandi della chat</b>
-<dd><b>/nick <i>&lt;nuovo_nickname&gt;</i></b> - cambio di nickname
+<!-- <dd><b>/nick <i>&lt;nuovo_nickname&gt;</i></b> - cambio di nickname -->
 <dd><b>/tav <i>&lt;frase di invito&gt;</i></b> - invito per gli altri giocatori al tavolo dove si &egrave; seduti
 <dd><b>/st <i>&lt;stato&gt;</i></b> - cambia l\'icona associata al tuo user; <i>stato</i> pu&ograve; valere: \\"normale\\", \\"fuori\\", \\"pausa\\", \\"cibo\\", \\"cane\\", \\"lavoro\\", \\"presente\\" oppure \\"sigaretta\\"
 <dd><b>/cont <i>&lt;id partita&gt;</i></b> - quando si è a un tavolo per garantiti, permette di proseguire una partita giocata in precedenza con gli stessi giocatori
@@ -938,7 +938,7 @@ class Client_prefs {
 
     function user_load($user)
     {
-        fprintf(STDERR, "QQ %s: %x\n", __FUNCTION__, $user->flags);
+        // fprintf(STDERR, "QQ %s: %x\n", __FUNCTION__, $user->flags);
         $this->listen = ($user->flags & USER_FLAG_MAP_AUTH) >> 2;
         if ($user->rec != FALSE) {
             $this->supp_comp = $user->rec->supp_comp_get();
@@ -947,7 +947,7 @@ class Client_prefs {
             $this->supp_comp = "000000000000";
         }
 
-        fprintf(STDERR, "QQ %s: LISTEN: %d\n", __FUNCTION__, $this->listen);
+        // fprintf(STDERR, "QQ %s: LISTEN: %d\n", __FUNCTION__, $this->listen);
     }
 
     function json_load($json_s)
@@ -987,11 +987,11 @@ class Client_prefs {
     function store($user, $is_save)
     {
         // save into DB
-        fprintf(STDERR, "QQ %s::%s PRE: %x\n", __CLASS__, __FUNCTION__,
-                $user->flags & (~USER_FLAG_S_ALL & ~USER_FLAG_AUTH));
+        // fprintf(STDERR, "QQ %s::%s PRE: %x\n", __CLASS__, __FUNCTION__,
+        //         $user->flags & (~USER_FLAG_S_ALL & ~USER_FLAG_AUTH));
         $user->flags_set(($this->listen << 2), USER_FLAG_MAP_AUTH);
-        fprintf(STDERR, "QQ %s::%s %x\n", __CLASS__, __FUNCTION__,
-                $user->flags);
+        // fprintf(STDERR, "QQ %s::%s %x\n", __CLASS__, __FUNCTION__,
+        //         $user->flags);
         if ($user->is_supp_custom()) {
             $user->rec->supp_comp_set($this->supp_comp);
         }
@@ -1933,7 +1933,7 @@ class Brisk
     GLOBAL $G_base, $G_alarm_passwd, $mlang_brisk, $G_lang;
     $only_you = FALSE;
 
-    fprintf(STDERR, "WE ARE HERE: [%s]\n", $mesg);
+    // fprintf(STDERR, "WE ARE HERE: [%s]\n", $mesg);
 
     // common settings
     $msg = mb_substr($mesg, 6, 128, "UTF-8");
@@ -2558,7 +2558,7 @@ class Brisk
               $this->user[$idx]->flags |= USER_FLAG_LISTAUTH;
 
               if (isset($cookie['CO_list'])) {
-                  fprintf(STDERR, "QQ: %s CO_list: [%s]\n", __FUNCTION__, $cookie['CO_list']);
+                  // fprintf(STDERR, "QQ: %s CO_list: [%s]\n", __FUNCTION__, $cookie['CO_list']);
                   if (strcmp($cookie['CO_list'], "auth") == 0) {
                       $this->user[$idx]->flags &= ~USER_FLAG_MAP_AUTH;
                       $this->user[$idx]->flags |= USER_FLAG_LISTAUTH;
@@ -2572,11 +2572,11 @@ class Brisk
                   }
               }
           }
-          else {
-              fprintf(STDERR, "QQ: CO_list not set flags: %x\n", __FUNCTION__, $this->user[$idx]->flags);
-          }
+          // else {
+          //    fprintf(STDERR, "QQ: CO_list not set flags: %x\n", __FUNCTION__, $this->user[$idx]->flags);
+          // }
       }
-      fprintf(STDERR, "QQ %s: flag %x\n", __FUNCTION__, $this->user[$idx]->flags);
+      // fprintf(STDERR, "QQ %s: flag %x\n", __FUNCTION__, $this->user[$idx]->flags);
       if ($ghost > -1) {
         log_main("ghost: rename!");
         $ghost_user = $this->user[$ghost];
@@ -2750,12 +2750,12 @@ class Brisk
   {
       GLOBAL $G_ban_list, $G_black_list, $G_cloud_smasher;
 
-      printf("NEW_SOCKET (root): %d PATH [%s]\n", intval($new_socket), $path);
+      // printf("NEW_SOCKET (root): %d PATH [%s]\n", intval($new_socket), $path);
 
-      fprintf(STDERR, "\n\n\n PRE_BLACK [%s]\n\n\n", $addr);
+      // fprintf(STDERR, "\n\n\n PRE_BLACK [%s]\n\n\n", $addr);
       if ($this->black_check($addr)) {
           // TODO: waiting async 5 sec before close
-          fprintf(STDERR, "\n\n\n BLACK CHECK\n\n\n");
+          // fprintf(STDERR, "\n\n\n BLACK CHECK\n\n\n");
           return (FALSE);
       }
       if ($path != "" && $path != "index.php") {
@@ -2830,7 +2830,7 @@ class Brisk
               if (($prev = $user->rd_socket_get()) != NULL) {
                   $s_a_p->socks_unset($user->rd_socket_get());
                   fclose($user->rd_socket_get());
-                  printf("CLOSE AND OPEN AGAIN ON IFRA2\n");
+                  // printf("CLOSE AND OPEN AGAIN ON IFRA2\n");
                   $user->rd_socket_set(NULL);
               }
 
@@ -2852,7 +2852,7 @@ class Brisk
 
               $s_a_p->socks_set($new_socket, $user, NULL);
               $user->rd_socket_set($new_socket);
-              printf(" - qui ci siamo - ");
+              // printf(" - qui ci siamo - ");
               return TRUE;
           } while (FALSE);
 
index 47fd0b1..c59deb3 100644 (file)
@@ -163,7 +163,7 @@ class Hardbans {
        log_main("ftok failed");
        break;
       }
-      fprintf(STDERR, "hardpans: %x\n", $tok);
+      // fprintf(STDERR, "hardpans: %x\n", $tok);
       if (($shm_sz = sharedmem_sz($tok)) == -1) {
        log_main("shmop_open failed");
       }
index fc01aba..57d9852 100644 (file)
@@ -82,7 +82,7 @@ class ProviderProxy
 
     function realip(&$header, $ip)
     {
-        fprintf(STDERR, "PP realip: [%d]\n", count($this->pp));
+        // fprintf(STDERR, "PP realip: [%d]\n", count($this->pp));
         if ($this->pp != NULL) {
             foreach ($this->pp as $pp_name => $pp_item) {
                 // fprintf(STDERR, "PP loop: [%s][%s]\n", $pp_name, $ip);
@@ -100,4 +100,4 @@ class ProviderProxy
     }
 }
 
-?>
\ No newline at end of file
+?>
index 3771d4d..6efc241 100644 (file)
@@ -22,7 +22,7 @@
  *
  */
 
-define('SITE_PREFIX', '/brisk/');
+define('SITE_PREFIX', "/brisk/");
 define('SITE_PREFIX_LEN', 7);
 
 define('DIRECT_ST_READ',  1);
@@ -139,7 +139,7 @@ function spu_process_info($stream_info, &$method, &$header, &$get, &$post, &$coo
     $post = array();
     $rest = 0;
     foreach(preg_split("/(\r?\n)/", $stream_info) as $line) {
-        printf("LINE: [%s]\n", $line);
+        // printf("LINE: [%s]\n", $line);
         if ($check_post) {
             if (!isset($header['The-Request'])) {
                 return FALSE;
@@ -173,7 +173,7 @@ function spu_process_info($stream_info, &$method, &$header, &$get, &$post, &$coo
             $path = $get_vars[0];
             if (count($get_vars) > 1) {
                 $a = explode('&', $get_vars[1]);
-                printf("A COUNT: [%s] %d\n", $a[0], count($a));
+                // printf("A COUNT: [%s] %d\n", $a[0], count($a));
                 for ($i = 0 ; $i < count($a) ; $i++) {
                     $b = explode('=', $a[$i]);
                     if ($b[0] == "")
@@ -195,7 +195,7 @@ function spu_process_info($stream_info, &$method, &$header, &$get, &$post, &$coo
                     return FALSE;
                 }
                 $post_len = mb_strlen($line, "ASCII");
-                printf("INFO: postlen: %d\n", $post_len);
+                // printf("INFO: postlen: %d\n", $post_len);
                 $rest = (int)($header['Content-Length']) - $post_len;
 
                 if ($rest == 0) {
@@ -577,7 +577,7 @@ class Sac_a_push {
 
         $pendpage->try_flush($this->curtime);
         // Add $pendpage to the pendpage array (in any case)
-        fprintf(STDERR, "IMPORTANT: Pendadd: %d\n", $pendpage->status);
+        // fprintf(STDERR, "IMPORTANT: Pendadd: %d\n", $pendpage->status);
         $this->pendpage_add($pendpage);
     }
 
@@ -641,7 +641,7 @@ class Sac_a_push {
                         unset($this->socks[$id]);
                         unset($this->s2u[$id]);
                         fclose($sock);
-                        printf("CLOSE ON GARBAGE MANAGER\n");
+                        // printf("CLOSE ON GARBAGE MANAGER\n");
                     }
                 }
             }
@@ -688,10 +688,14 @@ class Sac_a_push {
         
         $this->main_loop = TRUE;
         
+        $lastime = 0;
+        $dump_users = TRUE;
         while ($this->main_loop) {
             $this->app->sess_cur_set(FALSE);
             $this->curtime = time();
-            fprintf(STDERR, "IN LOOP: Current opened: %d  pending_pages: %d\n", count($this->socks), count($this->pending_pages));
+            if ($lastime != ($this->curtime >> 2)) {
+                fprintf(STDERR, "\nIN LOOP: Current opened: %d  pending_pages: %d\n", count($this->socks), count($this->pending_pages));
+            }
             
             /* Prepare the read array */
             /* // when we manage it ... */
@@ -718,10 +722,13 @@ class Sac_a_push {
             $num_changed_sockets = @stream_select($read, $write, $except, 0, 500000);
         
             if ($num_changed_sockets == 0) {
-                printf(" no data in 5 secs, splash [%d]\n", $G_with_splash);
+                // printf(" no data in 5 secs, splash [%d]\n", $G_with_splash);
+                ;
             } 
             else if ($num_changed_sockets > 0) {
-                printf("num sock %d num_of_socket: %d\n", $num_changed_sockets, count($read));
+                if ($lastime != ($this->curtime >> 2)) {
+                    printf("num sock %d num_of_socket: %d\n", $num_changed_sockets, count($read));
+                }
                 if ($this->debug > 1) {
                     print_r($read);
                 }
@@ -735,7 +742,7 @@ class Sac_a_push {
                         continue;
                     }
                     if ($sock === $this->list_web) {
-                        printf("NUOVA CONNEX\n");
+                        // printf("NUOVA CONNEX\n");
                         if (($new_unix = stream_socket_accept($this->list_web)) == FALSE) {
                             printf("SOCKET_ACCEPT FAILED\n");
                             continue;
@@ -748,7 +755,7 @@ class Sac_a_push {
                         $rest        = 0;
                         $cont        = "";
                         if (($new_socket = ancillary_getstream($new_unix, $stream_info)) !== FALSE) {
-                            printf("NEW_SOCKET: %d\n", intval($new_socket));
+                            // printf("NEW_SOCKET: %d\n", intval($new_socket));
                             stream_set_blocking($new_socket, $this->blocking_mode); // Set the stream to non-blocking
                             // error_log(sprintf("RECEIVED HEADER:\n%s", $stream_info));
                             if (($path = spu_process_info($stream_info, $method, $header,
@@ -770,10 +777,10 @@ class Sac_a_push {
                             // FOR TEST $header['X-Forwarded-For'] = '154.155.22.33';
                             $addr = $this->pproxy_realip($header, $addr);
 
-                            printf("PATH: [%s] [%s]\n", $path, print_r($header, TRUE));
+                            // printf("PATH: [%s] [%s]\n", $path, print_r($header, TRUE));
                             if ($method == "POST" && $rest > 0) {
                                 if (isset($header['Expect']) && $header['Expect'] == '100-continue') {
-                                    fprintf(STDERR, "\nPOSTA DE CHE\n\n");
+                                    // fprintf(STDERR, "\nPOSTA DE CHE\n\n");
                                     $this->pendpage_try_addcont($new_socket, 20,
                                                                 $method, $header, $get, $post, $cookie,
                                                                 $path, $addr, $rest, $cont);
@@ -788,14 +795,14 @@ class Sac_a_push {
                                 $manage_page = TRUE;
                             }
 
-                            printf("number of sockets after %d\n", count($this->socks));
+                            // printf("number of sockets after %d\n", count($this->socks));
                         }
                         else {
                             printf("WARNING: ancillary_getstream failed\n");
                         }
                     }
                     else if ($sock === $this->list_cmd) {
-                        printf("NUOVA DIRECT CONNEX\n");
+                        // printf("NUOVA DIRECT CONNEX\n");
                         if (($new_unix = stream_socket_accept($this->list_cmd)) == FALSE) {
                             printf("SOCKET_ACCEPT FAILED\n");
                             continue;
@@ -809,18 +816,19 @@ class Sac_a_push {
                         if ($buf == FALSE || feof($sock)) {
                             // close socket case
                             if ($buf == FALSE) {
-                                printf("INFO: read return false\n");
+                                // printf("INFO: read return false\n");
+                                ;
                             }
                             if ($sock === $this->list_web) {
-                                printf("Arrivati %d bytes da list\n", mb_strlen($buf, "ASCII"));
+                                // printf("Arrivati %d bytes da list\n", mb_strlen($buf, "ASCII"));
                                 return(21);
                             }
                             else if ($sock === $this->list_cmd) {
-                                printf("Arrivati %d bytes da list_cmd\n", mb_strlen($buf, "ASCII"));
+                                // printf("Arrivati %d bytes da list_cmd\n", mb_strlen($buf, "ASCII"));
                                 return(23);
                             }
                             else if ($sock === $this->in || $sock === static::$cnt_slave) {
-                                printf("Arrivati %d bytes da stdin\n", mb_strlen($buf, "ASCII"));
+                                // printf("Arrivati %d bytes da stdin\n", mb_strlen($buf, "ASCII"));
                                 return(22);
                             }
                             else {
@@ -838,7 +846,7 @@ class Sac_a_push {
                                 }
                             }
                             fclose($sock);
-                            printf("CLOSE ON READ\n");
+                            // printf("CLOSE ON READ\n");
 
                             if ($this->debug > 1) {
                                 printf("post unset\n");
@@ -850,13 +858,15 @@ class Sac_a_push {
                                 print_r($read);
                             }
                             if ($sock === $this->list_web) {
-                                printf("Arrivati %d bytes da list\n", mb_strlen($buf, "ASCII"));
+                                // printf("Arrivati %d bytes da list\n", mb_strlen($buf, "ASCII"));
+                                ;
                             }
                             else if ($sock === $this->list_cmd) {
-                                printf("Arrivati %d bytes da list_cmd\n", mb_strlen($buf, "ASCII"));
+                                // printf("Arrivati %d bytes da list_cmd\n", mb_strlen($buf, "ASCII"));
+                                ;
                             }
                             else if ($sock === $this->in || $sock === static::$cnt_slave) {
-                                printf("Arrivati %d bytes da stdin\n", mb_strlen($buf, "ASCII"));
+                                // printf("Arrivati %d bytes da stdin\n", mb_strlen($buf, "ASCII"));
                                 $line = trim($buf);
                                 if ($line == "reload") {
                                     require("$DOCUMENT_ROOT/Etc/".BRISK_CONF);
@@ -869,6 +879,9 @@ class Sac_a_push {
                                     }
                                     global_dump();
                                 }
+                                else if ($line == "dump") {
+                                    $dump_users = TRUE;
+                                }
                                 else if ($line == "shutdown" || $line == "sd") {
                                     if ($this->app->dump_data()) {
                                         return(0);
@@ -880,7 +893,7 @@ class Sac_a_push {
                             }
                             else {  // data arrived from not special socket
                                 $key = array_search("$sock", $this->socks);
-                                fprintf(STDERR, "Arrivati %d bytes dalla socket n. %d\n", mb_strlen($buf, "ASCII"), $key);
+                                // fprintf(STDERR, "Arrivati %d bytes dalla socket n. %d\n", mb_strlen($buf, "ASCII"), $key);
                                 if (isset($this->s2p[$id])) {
                                     $this->s2p[$id]->rest -= mb_strlen($buf, "ASCII");
                                     $this->s2p[$id]->cont .= $buf;
@@ -900,6 +913,7 @@ class Sac_a_push {
                     }
 
                     if ($manage_page == TRUE) {
+                        /*
                         printf("M: %s\nHEADER:\n", $method);
                         print_r($header);
                         printf("GET:\n");
@@ -908,6 +922,7 @@ class Sac_a_push {
                         print_r($post);
                         printf("COOKIE:\n");
                         print_r($cookie);
+                        */
 
                         $header_out = array();
                         // TODO: MOVE DOWN request_mgr to factorize new_sockets and POST closed
@@ -964,7 +979,9 @@ class Sac_a_push {
                     if ($response == "") {
                         $content = "";
                         $user->stream_main($content, $get, $post, $cookie);
-                        printf("[%s] [%d] [%d]\n", $user->name, $user->lacc, $this->curtime);
+                        if ($dump_users) {
+                           printf("[%s] [%d] [%d]\n", $user->name, $user->lacc, $this->curtime);
+                        }
                         if ($do_ping && $user->ping_req == FALSE) {
                             $content .= $user->stream_keepalive(TRUE);
                             $user->ping_req = TRUE;
@@ -1007,14 +1024,16 @@ class Sac_a_push {
                         $clo_l = mb_strlen($clo, "ASCII");
                         @fwrite($sock, $clo, $clo_l);
                         fclose($sock);
-                        printf("CLOSE ON LOOP\n");
+                        // printf("CLOSE ON LOOP\n");
                     }
                 }  // if (isset($this->s2u[$id]...
             }  // foreach ($this->socks...
-            printf("\n");
+            $dump_users = FALSE;
+            printf("#");
             if (defined('CURL_DE_SAC_VERS')) {
                 $this->app->cds->process();
             }
+            $lastime = ($this->curtime >> 2);
         }  // while (...
     }  // function run(...
 
index 305dd34..573883c 100644 (file)
@@ -623,7 +623,7 @@ class User {
       // log_rd2("page_sync:".var_export(debug_backtrace()));
       
       log_rd2("PAGE_SYNC");
-      printf("xXx USER::PAGE_SYNC [%s]\n", get_class($this));
+      // printf("xXx USER::PAGE_SYNC [%s]\n", get_class($this));
       return (sprintf('createCookie("table_idx", %d, 24*365, cookiepath); createCookie("table_token", "%s", 24*365, cookiepath); xstm.stop(); window.onunload = null; window.onbeforeunload = null; document.location.assign("%s");', $table_idx, $table_token, $page));
   }
 
@@ -653,7 +653,7 @@ class User {
       
       log_rd2("do other cur_stat[".$this->rd_stat."] user->stat[".$this->stat."] cur_step[".$this->rd_step."] user_step[".$this->step."]");
       
-      fprintf(STDERR, "ASYNC: %d %d\n", $this->rd_step, $this->pend_async);
+      // fprintf(STDERR, "ASYNC: %d %d\n", $this->rd_step, $this->pend_async);
       if ($this->rd_step == -1 && $this->pend_async == 0) {
           /*  if $this->rd_step == -1 load the current state from the main struct  */
           $S_load_stat['wR_minusone']++;
@@ -736,7 +736,7 @@ class User {
            ***************/
           else if ($this->stat == 'table') {
               log_load("RESYNC");
-              printf("xXx USER::MAINCHECK1 [%s]\n", get_class($this));
+              // printf("xXx USER::MAINCHECK1 [%s]\n", get_class($this));
 
               return ($this->page_sync($this->sess, "briskin5/index.php", $this->table, $this->table_token));
           }
@@ -751,7 +751,7 @@ class User {
                       if (($this->rd_stat != $this->stat)) {
                           $to_stat = $this->stat;
                           log_load("RESYNC");
-                          printf("xXx USER::MAINCHECK2 [%s]\n", get_class($this));
+                          // printf("xXx USER::MAINCHECK2 [%s]\n", get_class($this));
                           return ($this->page_sync($this->sess, ($to_stat == "table" ? "briskin5/index.php" : "index.php"), $this->table, $this->table_token));
                       }
                       log_rd2("lost history, refresh from scratch");
@@ -789,7 +789,7 @@ class User {
 
   public static function stream_fini($transp, $init_string, $is_unrecoverable)
 {
-    printf("xXx user::stream_fini\n");
+    // printf("xXx user::stream_fini\n");
 
     // FIXME: dynamic "Transport_" type
     $trans_class = Transport::gettype($transp);
@@ -814,7 +814,7 @@ function stream_init($init_string, $enc, $header, &$header_out, &$body, $get, $p
 {
     $curtime = time();
     
-    printf("CLASS: [%s] base: [%s]\n", get_class($this), self::base_get());
+    // printf("CLASS: [%s] base: [%s]\n", get_class($this), self::base_get());
 
     log_load("index_rd_init.php");
     
@@ -849,12 +849,12 @@ function stream_main(&$body, $get, $post, $cookie)
     
     $pre_main = gettimeofday(TRUE);
     
-    printf("xXx PRE : rd_step %d\n", $this->rd_step);
+    // printf("xXx PRE : rd_step %d\n", $this->rd_step);
     if (($ret = $this->maincheck($get, $post, $cookie)) != FALSE) {
         $body .= $this->rd_transp->chunk( $this->rd_scristp++, $ret);
         log_rd2(0, 'index_rd.php: after mop_flush (begin: '.sprintf("%f", $pre_main).')');
     }
-    printf("xXx POST: rd_step %d\n", $this->rd_step);
+    // printf("xXx POST: rd_step %d\n", $this->rd_step);
 
     return TRUE;
 }
@@ -872,7 +872,7 @@ function stream_close()
 static function base_get()
 {
     $c = get_called_class();
-    printf("CALLED_CLASS: [%s]\n", $c);
+    // printf("CALLED_CLASS: [%s]\n", $c);
     return $c::BASE;
 }
 
index 35d316e..9382782 100644 (file)
@@ -947,7 +947,7 @@ class Bin5_user extends User {
     protected function page_sync($sess, $page)
     {
         log_rd2("PAGE_SYNC");
-        printf("xXx BIN5_USER::PAGE_SYNC\n");
+        // printf("xXx BIN5_USER::PAGE_SYNC\n");
         return (sprintf('xstm.stop(); window.onbeforeunload = null; window.onunload = null; document.location.assign("%s");', $page));
     }
 
@@ -1004,7 +1004,7 @@ class Bin5_user extends User {
           if ($this->stat == 'table') {
               log_load("RESYNC");
               /* NOTE: $this->room is associated with the current $bri object */
-              printf("xXx CLASS NAME [%s]\n", get_class($this->room));
+              // printf("xXx CLASS NAME [%s]\n", get_class($this->room));
               $ret = show_table($this->room, $this, $this->step, FALSE, FALSE);
           }
           log_rd2("NEWSTAT: ".$this->stat);
@@ -1022,11 +1022,11 @@ class Bin5_user extends User {
                       if ($this->rd_stat != $this->stat) {
                           $to_stat = $this->stat;
                           log_load("RESYNC");
-                          printf("xXx BIN5_USER::MAINCHECK\n");
+                          // printf("xXx BIN5_USER::MAINCHECK\n");
                           return ($this->page_sync($this->sess, ($to_stat == "table" ? "index.php" : "../index.php"), $this->table, $this->table_token));
                       }
                       log_rd2("lost history, refresh from scratch");
-                      printf("xXx LOST HISTORY!\n");
+                      // printf("xXx LOST HISTORY!\n");
                       $this->rd_step = -1;
                       break;
                   }
@@ -1403,7 +1403,7 @@ class Bin5 {
     {
         GLOBAL $G_ban_list, $G_black_list;
 
-        printf("NEW_SOCKET (root): %d\n", intval($new_socket));
+        // printf("NEW_SOCKET (root): %d\n", intval($new_socket));
 
         $enc = get_encoding($header);
         if (isset($header['User-Agent'])) {
@@ -1483,7 +1483,7 @@ class Bin5 {
                 if (($prev = $user->rd_socket_get()) != NULL) {
                     $s_a_p->socks_unset($user->rd_socket_get());
                     fclose($user->rd_socket_get());
-                    printf("CLOSE AND OPEN AGAIN ON IFRA2\n");
+                    // printf("CLOSE AND OPEN AGAIN ON IFRA2\n");
                     $user->rd_socket_set(NULL);
                 }
 
@@ -1506,7 +1506,7 @@ class Bin5 {
 
                 $s_a_p->socks_set($new_socket, $user, NULL);
                 $user->rd_socket_set($new_socket);
-                printf(" - qui ci siamo - ");
+                // printf(" - qui ci siamo - ");
                 return TRUE;
             } while (FALSE);
 
index af1664a..6e39606 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 var PLAYERS_N = 3;
-var EXIT_BAN_TIME = 3600;
+var EXIT_BAN_TIME = 900;
 var cookiepath = "/brisk/";
 
 var mlang_commons = { 'imgload_a' : { 'it' : 'Immagini caricate ',
index 39e2a54..6e6d50a 100644 (file)
@@ -493,7 +493,7 @@ function index_main(&$brisk, $transp_type, $header, &$header_out, $remote_addr_f
                 }
             }
             else {
-                fprintf(STDERR, "POST CHECK QUI\n");
+                // fprintf(STDERR, "POST CHECK QUI\n");
                 /* Login Rendering */
                 switch($idx) {
                 case -4:
index 6701425..dd2d9db 100644 (file)
@@ -322,7 +322,7 @@ function index_wr_main(&$brisk, $remote_addr_full, $get, $post, $cookie)
                 }
 
                 $bdb->transaction('COMMIT');
-                fprintf(STDERR, "REMOTE: %d\n", $remote_ip);
+                // fprintf(STDERR, "REMOTE: %d\n", $remote_ip);
                 echo "1";
                 return TRUE;
             } while(FALSE);
index 0f22baa..11e5497 100644 (file)
@@ -52,7 +52,7 @@ class PendingPage {
   function PendingPage($socket, $curtime, $kalive)
   {
       $this->socket = $socket;
-      fprintf(STDERR, "SOCKET ADD: %s\n", $this->socket);
+      // fprintf(STDERR, "SOCKET ADD: %s\n", $this->socket);
       $this->kalive = $curtime + $kalive;
   }
 
@@ -81,7 +81,7 @@ class PendingPage {
 
   function to_continuing()
   {
-      printf("TRY FLUSH CREATE\n");
+      // printf("TRY FLUSH CREATE\n");
       $header = array();
       $header['HTTP-Response'] = "100 Continue";
       $hea = headers_render($header, 0);
@@ -136,7 +136,7 @@ class PendingPage {
 
   function to_flushing($enc, &$header_out, $body)
   {
-      printf("TRY FLUSH CREATE: enc[%s]\n", $enc);
+      // printf("TRY FLUSH CREATE: enc[%s]\n", $enc);
       $body_out = ZLibStream::compress($enc, $body);
       if ($enc != 'plain')
           $header_out['Content-Encoding'] = $enc;
@@ -147,26 +147,26 @@ class PendingPage {
       $this->status = PENDINGPAGE_FLUSH;
       $this->msg    = $hea.$body_out;
       $this->msg_sz = $hea_sz + $body_out_sz;
-      printf("TRY FLUSH CREATE: enc[%s]\n", $enc);
+      // printf("TRY FLUSH CREATE: enc[%s]\n", $enc);
   }
 
   /* return TRUE if is removable from it's list */
   function try_flush($curtime)
   {
-      fprintf(STDERR, "IMPORTANT: TRY_FLUSH: start %d\n", $this->status);
+      // fprintf(STDERR, "IMPORTANT: TRY_FLUSH: start %d\n", $this->status);
       if ($this->status != PENDINGPAGE_FLUSH &&
           $this->status != PENDINGPAGE_CONTINUE)
           return (FALSE);
 
       if ($this->kalive < $curtime) {
-          printf("TRY FLUSH CLOSE 1\n");
+          // printf("TRY FLUSH CLOSE 1\n");
           @fclose($this->socket);
           return TRUE;
       }   
 
       $wret = @fwrite($this->socket, $this->msg, mb_strlen($this->msg, "ASCII"));
       if ($wret == FALSE && $wret !== FALSE) {
-          printf("TRY FLUSH PendingPage::try_flush: wret 0 but not FALSE [%d]\n", mb_strlen($this->msg, "ASCII"));
+          // printf("TRY FLUSH PendingPage::try_flush: wret 0 but not FALSE [%d]\n", mb_strlen($this->msg, "ASCII"));
       }
       if ($wret == $this->msg_sz) {
           if ($this->status == PENDINGPAGE_CONTINUE) {
@@ -174,7 +174,7 @@ class PendingPage {
               return FALSE;
           }
           else {
-              printf("TRY FLUSH CLOSE 2\n");
+              // printf("TRY FLUSH CLOSE 2\n");
               fclose($this->socket);
               return TRUE;
           }
@@ -182,7 +182,7 @@ class PendingPage {
       $this->msg_sz -= $wret;
       $this->msg    = mb_substr($this->msg, $wret, $this->msg_sz, "ASCII");
 
-      printf("TRY FLUSH RETURN FALSE\n");
+      // printf("TRY FLUSH RETURN FALSE\n");
 
       return FALSE;
   }