瀏覽代碼

ping_not_response_limit 可以设置成0

liangl 11 年之前
父節點
當前提交
85944dd88c
共有 1 個文件被更改,包括 3 次插入7 次删除
  1. 3 7
      applications/Demo/Bootstrap/Gateway.php

+ 3 - 7
applications/Demo/Bootstrap/Gateway.php

@@ -93,7 +93,7 @@ class Gateway extends Man\Core\SocketWorker
     /**
      * 客户端连续$pingNotResponseLimit次不回应心跳则断开链接
      */
-    protected $pingNotResponseLimit = 1;
+    protected $pingNotResponseLimit = 0;
     
     /**
      * 命令字,统计用到
@@ -211,11 +211,7 @@ class Gateway extends Man\Core\SocketWorker
         }
         
         // 不返回心跳回应的限定值
-        $ping_not_response_limit = (int)\Man\Core\Lib\Config::get($this->workerName.'.ping_not_response_limit');
-        if($ping_not_response_limit > 0)
-        {
-            $this->pingNotResponseLimit = $ping_not_response_limit;
-        }
+        $this->pingNotResponseLimit = (int)\Man\Core\Lib\Config::get($this->workerName.'.ping_not_response_limit');
         
         // 设置定时任务,发送心跳
         if($this->pingInterval > 0 && $this->pingData)
@@ -723,7 +719,7 @@ class Gateway extends Man\Core\SocketWorker
                 continue;
             }
             // 上次发送的心跳还没有回复次数大于限定值就断开
-            if($not_response_count >= $this->pingNotResponseLimit)
+            if($this->pingNotResponseLimit > 0 && $not_response_count >= $this->pingNotResponseLimit)
             {
                 $this->closeClient($this->clientConnMap[$client_id]);
             }