public function finish() { if ($this->finished) { return; } $this->finished = true; $this->eventLoop->interrupt(); $this->onFinish(); if (!$this->writing) { $this->close(); } }