stanley-king 8 rokov pred
rodič
commit
bf667a6f9c

+ 3 - 0
fcgi_run.php

@@ -16,6 +16,9 @@ require_once (BASE_ROOT_PATH . '/helper/index_tab.php');
 
 Base::mobile_init();
 
+$trdid = Thread::getCurrentThreadId();
+Log::record("thread id = {$trdid}",Log::INFO);
+
 $gMessageStates = new MsgStates();
 StatesHelper::init();
 $gMessageLock = Mutex::create();

+ 1 - 1
helper/index_tab.php

@@ -48,7 +48,7 @@ class index_tab
 
     private function init()
     {
-        Log::record("init tags data.");
+        Log::record("init tags data.",Log::INFO);
 
         $this->mTabs = [];
         $mod_webcode = Model('web_code');

+ 18 - 7
helper/message/msgutil.php

@@ -21,21 +21,32 @@ class StatesHelper
             $states['tags'] = true;
         }
     }
+
     static public function fetch_state($tag)
     {
         global $gMessageStates;
         global $gMessageLock;
 
+        $trdid = Thread::getCurrentThreadId();
+        Log::record("thread id = {$trdid}",Log::INFO);
+
+        $finded = false;
         Mutex::lock($gMessageLock);
-        if(is_array($gMessageStates) && array_key_exists($tag,$gMessageStates))
+        foreach ($gMessageStates as $key => $val)
         {
-            $state = $gMessageStates[$tag];
-            if($state == true) {
-                $gMessageLock[$tag] = false;
+            if($key == $tag)
+            {
+                $finded = true;
+                $state = $gMessageStates[$tag];
+                if($state == true) {
+                    $gMessageStates[$tag] = false;
+                    break;
+                }
             }
         }
-        else {
-            $gMessageLock[$tag] = false;
+
+        if($finded == false) {
+            $gMessageStates[$tag] = false;
             $state = true;
         }
         Mutex::unlock($gMessageLock);
@@ -56,7 +67,7 @@ class StatesHelper
 
 function handler_redis($redis, $chan, $msg)
 {
-    Log::record("message: {$chan} -- {$msg}",Log::DEBUG);
+    Log::record("message: {$chan} -- {$msg}",Log::INFO);
     $cur_trd = Thread::getCurrentThread();
     $cur_trd->dispatch($chan,$msg);
 }

+ 1 - 1
local_start.sh

@@ -1,2 +1,2 @@
 #! /bin/sh
-spawn-fcgi -a 127.0.0.1 -p 9100 -F 1 -f "php fcgi_run.php"
+spawn-fcgi -a 127.0.0.1 -p 9100 -F 1 -u _www -g _www -f "php fcgi_run.php"

+ 0 - 2
mobile/control/index.php

@@ -16,8 +16,6 @@ require_once(BASE_ROOT_PATH . '/helper/special_helper.php');
 require_once(BASE_ROOT_PATH . '/helper/index_tab.php');
 require_once(BASE_ROOT_PATH . '/mobile/control/special.php');
 
-
-
 class indexControl extends specialControl
 {
     const HomeSpecialID = 0;