public function dispose() { if (!$this->stream instanceof Stream) { parent::dispose(); return; } if ($socket = $this->stream->getSocket()) { EventLoop::getLoop()->removeReadStream($socket); if (is_resource($socket)) { @fclose($socket); } } parent::dispose(); }
/** * Transport constructor. * @param $socket * @param LoopInterface $loop */ public function __construct($socket, LoopInterface $loop) { parent::__construct($socket, $loop); $this->loop->addReadStream($this->socket, [$this, 'readSocket']); }