From 7bc6cb78b83c5cdca71fa6ac9bb003b51b1f8968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 25 May 2021 10:18:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- System/Abstracts/Pool.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/System/Abstracts/Pool.php b/System/Abstracts/Pool.php index b8ba314a..32b65f2d 100644 --- a/System/Abstracts/Pool.php +++ b/System/Abstracts/Pool.php @@ -173,7 +173,7 @@ abstract class Pool extends Component return $this->createClient($name, $callback); } $channel = static::$_items[$name] ?? new Channel($this->max); - if (!isset(static::$_items[$name])) { + if (!((static::$_items[$name] ?? null) instanceof Channel)) { static::$_items[$name] = $channel; } if ($channel->isEmpty()) { @@ -296,11 +296,12 @@ abstract class Pool extends Component if (Coroutine::getCid() === -1) { return; } + $channel = static::$_items[$name] ?? new Channel($this->max); if (!isset(static::$_items[$name])) { - static::$_items[$name] = new Channel($this->max); + static::$_items[$name] = $channel; } - if (!static::$_items[$name]->isFull()) { - static::$_items[$name]->push($client); + if (!$channel->isFull()) { + $channel->push($client); } unset($client); }