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

Commit 0a4e6f1

Browse files
authored
Merge pull request #9 from AppleBlockTeam/dev
同步Dev
2 parents 83dafc6 + a3520b6 commit 0a4e6f1

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

inc/cluster.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public function downloadFiles() {
246246
$bar->end();
247247
}
248248

249-
private function downloadnopoen($hash) {
249+
public function downloadnopoen($hash) {
250250
global $DOWNLOAD_DIR;
251251
global $tokendata;
252252
$filePath = $DOWNLOAD_DIR . '/' . substr($hash, 0, 2) . '/';

inc/socketio.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function connect() {
2626
}
2727

2828
while(true) {
29-
$alldata = $client->recv(1.5);
29+
$alldata = $client->recv(1);
3030
if (!is_bool($alldata)){
3131
$this->data = $data = $alldata->data;
3232
preg_match('/^\d+/', $data, $code);
@@ -76,7 +76,7 @@ public function connect() {
7676
});
7777
}
7878
elseif (isset($jsondata[0][1]) && $jsondata[0][1] == "0"){
79-
mlog("[socket.io]主控返回节点已掉线");
79+
mlog("[socket.io]节点已掉线");
8080
global $pid;
8181
posix_kill($pid, SIGINT);
8282
}
@@ -86,6 +86,11 @@ public function connect() {
8686
}
8787
elseif (isset($jsondata[0][0]["message"])){
8888
mlog("[socket.io]Got data {$jsondata[0][0]["message"]}");
89+
if (strpos($jsondata[0][0]["message"], "Error") !== false) {
90+
mlog("[socket.io]节点启用失败");
91+
global $pid;
92+
posix_kill($pid, SIGINT);
93+
}
8994
}
9095
else {
9196
mlog("[socket.io]Got data {$data}");
@@ -94,15 +99,22 @@ public function connect() {
9499
}
95100
if ($code[0] == '423'){
96101
$data = substr($data, strlen($code[0]));
97-
mlog("[socket.io]Got data {$data}");
102+
if(isset($jsondata[0][0]["message"])){
103+
mlog("[socket.io]Got data {$jsondata[0][0]["message"]}");
104+
}
105+
else{
106+
mlog("[socket.io]Got data {$data}");
107+
}
98108
}
99109
//var_dump($data);
100-
Coroutine::sleep(0.1);
101110
}
102111
global $shouldExit;
103112
global $httpserver;
104113
if ($shouldExit) {
105-
Swoole\Timer::clear($katimeid);
114+
global $enable;
115+
if($enable){
116+
Swoole\Timer::clear($katimeid);
117+
}
106118
$this->disable();
107119
$httpserver->stopserver();
108120
return;

main.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use function Swoole\Coroutine\run;
44
use function Swoole\Timer;
55
declare(ticks=1)
6+
date_default_timezone_set('Asia/Shanghai');
67
set_time_limit(0);
78
ini_set('memory_limit', '-1');
89
require './config.php';

0 commit comments

Comments
 (0)