Пример #1
0
 function __construct($host = '0.0.0.0', $port = 80)
 {
     $this->sw_table = new \swoole_table($this->sw_table_size);
     /**
      * 内存表
      */
     $this->sw_table->column(self::$ConnectNameKey, \swoole_table::TYPE_INT, 8);
     //链接量
     $this->sw_table->column(self::$RequestingKey, \swoole_table::TYPE_INT, 8);
     //正在处理的请求
     $this->sw_table->create();
     $this->sw_table->set(self::$ConnectNameKey, [self::$ConnectNameKey => 0]);
     $this->sw_table->set(self::$RequestingKey, [self::$RequestingKey => 0]);
     $this->ConfigSWTable = new \swoole_table(1);
     $this->ConfigSWTable->column(self::HTTP_CONFIG_TABLE_KEY, \swoole_table::TYPE_STRING, 1024 * 5);
     $this->ConfigSWTable->create();
     //json 格式保存 服务器配置
     $this->ConfigSWTable->set(self::HTTP_CONFIG_TABLE_KEY, [self::HTTP_CONFIG_TABLE_KEY => '']);
     $this->createWorkerInfoTable();
     parent::__construct($host, $port);
 }