Skip to content

Commit e8b3632

Browse files
3.4.0适配swoole4.0.3
1 parent b6f86b7 commit e8b3632

File tree

4 files changed

+12
-16
lines changed

4 files changed

+12
-16
lines changed

src/Server/CoreBase/Actor.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,11 @@ public function tick($ms, $callback, $user_param = null)
331331
public function after($ms, $callback, $user_param = null)
332332
{
333333
$id = \swoole_timer_after($ms, function ($user_param_one) use ($callback) {
334-
go(function () use ($callback, $user_param_one) {
335-
try {
336-
$callback($user_param_one);
337-
} catch (\Throwable $e) {
338-
displayExceptionHandler($e);
339-
}
340-
});
334+
try {
335+
$callback($user_param_one);
336+
} catch (\Throwable $e) {
337+
displayExceptionHandler($e);
338+
}
341339
}, $user_param);
342340
$this->timerIdArr[$id] = $id;
343341
return $id;
@@ -356,6 +354,7 @@ public function clearTimer($id)
356354
/**
357355
* @param $actorName
358356
* @return ActorRpc
357+
* @throws SwooleException
359358
*/
360359
public static function getRpc($actorName)
361360
{

src/Server/Coroutine/CoroutineBase.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,10 @@ public function recv(callable $fuc = null)
126126
} else {
127127
$this->chan = new \chan();
128128
}
129-
$readArr = [$this->chan];
130-
$writeArr = null;
131-
$type = \chan::select($readArr, $writeArr, $this->MAX_TIMERS / 1000);
132-
if ($type) {
133-
$result = $this->chan->pop();
129+
$result = $this->chan->pop($this->MAX_TIMERS);
130+
if($result!==false){
134131
$result = $this->getResult($result);
135-
} else {//超时
132+
}else{//超时
136133
//有降级函数则访问降级函数
137134
if (empty($this->downgrade)) {
138135
$result = new SwooleException("[CoroutineTask]: Time Out!, [Request]: $this->request");

src/Server/SwooleServer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ abstract class SwooleServer extends ProcessRPC
3838
/**
3939
* 版本
4040
*/
41-
const version = "3.3.2";
41+
const version = "3.4.0";
4242

4343
/**
4444
* server name

src/Server/helpers/Common.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ function checkExtension()
136136
secho("STA", "[版本错误]PHP版本必须大于7.0.0\n");
137137
$check = false;
138138
}
139-
if (version_compare(SWOOLE_VERSION, '4.0.1', '<')) {
140-
secho("STA", "[版本错误]Swoole版本必须大于4.0.1\n");
139+
if (version_compare(SWOOLE_VERSION, '4.0.3', '<')) {
140+
secho("STA", "[版本错误]Swoole版本必须大于4.0.3\n");
141141
$check = false;
142142
}
143143

0 commit comments

Comments
 (0)