From a4bd152b59a82d0ed3af3fac1e21349ecc94e684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Mon, 14 Feb 2022 14:42:07 +0800 Subject: [PATCH] modify plugin name --- Coroutine/Http.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Coroutine/Http.php b/Coroutine/Http.php index 92e4d19..5cecf20 100644 --- a/Coroutine/Http.php +++ b/Coroutine/Http.php @@ -163,14 +163,17 @@ class Http extends Component $open($request); } } - while (($data = $response->recv()) instanceof Frame) { - try { - if ($data->opcode == WEBSOCKET_OPCODE_PING || $data->opcode == WEBSOCKET_OPCODE_PONG) { - continue; + + if ($response->isWritable()) { + while (($data = $response->recv()) instanceof Frame) { + try { + if ($data->opcode == WEBSOCKET_OPCODE_PING || $data->opcode == WEBSOCKET_OPCODE_PONG) { + continue; + } + call_user_func($message, $data); + } catch (\Throwable $throwable) { + $this->logger()->error($throwable->getMessage()); } - call_user_func($message, $data); - } catch (\Throwable $throwable) { - $this->logger()->error($throwable->getMessage()); } } call_user_func($close, $response->fd);