Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Commit dac4eab

Browse files
authored
Merge pull request #8 from AppleBlockTeam/dev
同步Dev分支
2 parents aafe65a + 1b2f4ba commit dac4eab

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"public_port"=> 4000,//服务端口
88
"CLUSTER_ID"=> "",
99
"CLUSTER_SECRET"=> "",
10+
"byoc"=>false,
1011
],
1112
"file"=> [
1213
"cache_dir"=> "./cache",//缓存文件夹

inc/server.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ public function startserver() {
107107
else{
108108
$url = $request->server['request_uri']."?".$request->server['query_string'];
109109
}
110+
//真的会有启动器不带ua的啊,太神奇了
111+
if(!isset($request->server['user-agent'])){
112+
$request->server['user-agent'] = "other";
113+
}
110114
mlog(" Serve {$code} | {$request->server['remote_addr']} | {$request->server['server_protocol']} | {$url} | {$request->header['user-agent']};") ;
111115
});
112116
$server->handle('/measure', function ($request, $response) {

inc/socketio.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function ack($event,$data = "") {
142142
public function Getclient() {
143143
return $this->client;
144144
}
145-
public function enable($host,$port) {
145+
public function enable($host,$port,$byoc) {
146146
if (in_array($host, ["0.0.0.0", "127.0.0.1"])){
147147
$host = preg_replace('/\R/', '', file_get_contents('http://ip.3322.net'));
148148
}
@@ -151,7 +151,7 @@ public function enable($host,$port) {
151151
'host' => $host,
152152
'port' => $port,
153153
'version' => VERSION,
154-
'byoc' => false,
154+
'byoc' => $byoc,
155155
'noFastEnable' => false,
156156
'flavor' =>[
157157
'runtime' => 'PHP-'.substr(PHP_VERSION,0,3).'/'.php_uname('s'),

main.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
use function Swoole\Coroutine\run;
44
use function Swoole\Timer;
55
declare(ticks=1)
6+
set_time_limit(0);
7+
ini_set('memory_limit', '-1');
68
require './config.php';
79
const PHPOBAVERSION = '1.3.0';
810
const VERSION = '1.10.4';
@@ -135,6 +137,6 @@ function registerSigintHandler() {
135137
Coroutine::create(function () use ($config,$httpserver){
136138
$httpserver->startserver();
137139
});
138-
$socketio->enable($config['cluster']['public_host'],$config['cluster']['public_port']);
140+
$socketio->enable($config['cluster']['public_host'],$config['cluster']['public_port'],$config['cluster']['byoc']);
139141
}
140142
});

0 commit comments

Comments
 (0)