Browse Source

Gateway判断消息完整性

walkor 11 years ago
parent
commit
cf82be97fa

+ 1 - 0
applications/ChatDemo/Bootstrap/Gateway.php

@@ -11,6 +11,7 @@
 define('ROOT_DIR', realpath(__DIR__.'/../'));
 require_once ROOT_DIR . '/Protocols/GatewayProtocol.php';
 require_once ROOT_DIR . '/Lib/Store.php';
+require_once ROOT_DIR . '/Event.php';
 require_once ROOT_DIR . '/Lib/StatisticClient.php';
 
 class Gateway extends Man\Core\SocketWorker

+ 0 - 3
applications/ChatDemo/Event.php

@@ -6,9 +6,6 @@
  * 
  */
 
-require_once ROOT_DIR . '/Lib/Gateway.php';
-require_once ROOT_DIR . '/Protocols/JsonProtocol.php';
-
 class Event
 {
     /**

+ 1 - 1
workerman/conf/conf.d/Gateway.conf

@@ -15,7 +15,7 @@ user = root
 
 ;每个请求预读长度,避免读取数据超过一个协议包,
 ;一般设置为协议头的长度,当请求到来时在dealInput中根据头部标识的数据包长度计算还有多少数据没接收完毕,并返回这个值
-preread_length = 65535
+preread_length = 4
 
 ;接收缓冲区大小设置
 max_recv_buffer_size = 10485760