diff --git a/config.php b/config.php index b8cb580..adf6ec8 100644 --- a/config.php +++ b/config.php @@ -7,6 +7,7 @@ "public_port"=> 4000,//服务端口 "CLUSTER_ID"=> "", "CLUSTER_SECRET"=> "", + "byoc"=>false, ], "file"=> [ "cache_dir"=> "./cache",//缓存文件夹 diff --git a/inc/server.php b/inc/server.php index e1a2873..5221691 100644 --- a/inc/server.php +++ b/inc/server.php @@ -107,6 +107,10 @@ public function startserver() { else{ $url = $request->server['request_uri']."?".$request->server['query_string']; } + //真的会有启动器不带ua的啊,太神奇了 + if(!isset($request->server['user-agent'])){ + $request->server['user-agent'] = "other"; + } mlog(" Serve {$code} | {$request->server['remote_addr']} | {$request->server['server_protocol']} | {$url} | {$request->header['user-agent']};") ; }); $server->handle('/measure', function ($request, $response) { diff --git a/inc/socketio.php b/inc/socketio.php index 2cae699..d08b7b2 100644 --- a/inc/socketio.php +++ b/inc/socketio.php @@ -142,7 +142,7 @@ public function ack($event,$data = "") { public function Getclient() { return $this->client; } - public function enable($host,$port) { + public function enable($host,$port,$byoc) { if (in_array($host, ["0.0.0.0", "127.0.0.1"])){ $host = preg_replace('/\R/', '', file_get_contents('http://ip.3322.net')); } @@ -151,7 +151,7 @@ public function enable($host,$port) { 'host' => $host, 'port' => $port, 'version' => VERSION, - 'byoc' => false, + 'byoc' => $byoc, 'noFastEnable' => false, 'flavor' =>[ 'runtime' => 'PHP-'.substr(PHP_VERSION,0,3).'/'.php_uname('s'), diff --git a/main.php b/main.php index 79a873d..2ba5e68 100644 --- a/main.php +++ b/main.php @@ -3,8 +3,10 @@ use function Swoole\Coroutine\run; use function Swoole\Timer; declare(ticks=1) +set_time_limit(0); +ini_set('memory_limit', '-1'); require './config.php'; -const PHPOBAVERSION = '1.2.0'; +const PHPOBAVERSION = '1.3.0'; const VERSION = '1.10.4'; global $DOWNLOAD_DIR; $DOWNLOAD_DIR = $config['file']['cache_dir']; @@ -135,6 +137,6 @@ function registerSigintHandler() { Coroutine::create(function () use ($config,$httpserver){ $httpserver->startserver(); }); - $socketio->enable($config['cluster']['public_host'],$config['cluster']['public_port']); + $socketio->enable($config['cluster']['public_host'],$config['cluster']['public_port'],$config['cluster']['byoc']); } }); \ No newline at end of file