public function onFinish() { Timer::remove($this->keepaliveTimer); if ($this->req !== null && $this->req instanceof Generic) { if (!$this->req->isFinished()) { $this->req->abort(); } } $this->req = null; }