From 5bd3d98250bba3296277608462617e4e07608361 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Mon, 6 Sep 2021 01:57:01 +0800 Subject: [PATCH] 111 --- core/Pool/Pool.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/core/Pool/Pool.php b/core/Pool/Pool.php index 574292bd..54106871 100644 --- a/core/Pool/Pool.php +++ b/core/Pool/Pool.php @@ -47,14 +47,12 @@ class Pool extends Component */ protected function pop(Channel $channel, $retain_number): void { - if (!Context::inCoroutine()) { - $channel->close(); - return; - } while ($channel->length() > $retain_number) { - $connection = $channel->pop(); - if ($connection instanceof StopHeartbeatCheck) { - $connection->stopHeartbeatCheck(); + if (Context::inCoroutine()) { + $connection = $channel->pop(); + if ($connection instanceof StopHeartbeatCheck) { + $connection->stopHeartbeatCheck(); + } } } }