diff --git a/kiri-websocket-server/Server.php b/kiri-websocket-server/Server.php index 9c84b45d..905e6d9b 100644 --- a/kiri-websocket-server/Server.php +++ b/kiri-websocket-server/Server.php @@ -52,13 +52,20 @@ class Server extends AbstractServer /** * @param int $fd + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface */ public function onClose(int $fd): void { $collector = $this->getContainer()->get(Sender::class); + + $fds = $this->getContainer()->get(FdCollector::class); + if (!$collector->isEstablished($fd)) { return; } + $fds->remove($fd); + if ($this->callback instanceof OnCloseInterface) { $this->callback->onClose($fd); }