/** * Close and free resources if necessary. * * @return void * @task internal */ private function closeProcess() { foreach ($this->pipes as $pipe) { if (isset($pipe)) { @fclose($pipe); } } $this->pipes = array(null, null, null); if ($this->proc) { @proc_close($this->proc); $this->proc = null; } $this->stdin = null; if ($this->profilerCallID !== null) { $profiler = ServiceProfiler\PhutilServiceProfiler::getInstance(); $profiler->endServiceCall($this->profilerCallID, array('err' => $this->result ? Utils\Utils::idx($this->result, 0) : null)); $this->profilerCallID = null; } }
private function checkSocket() { $timeout = false; $now = microtime(true); if ($now - $this->stateStartTime > $this->getTimeout()) { $timeout = true; } if (!feof($this->socket) && !$timeout) { return false; } $this->stateReady = true; if ($timeout) { $this->result = $this->buildErrorResult(Status_HTTPFutureResponseStatusTransport::ERROR_TIMEOUT); } else { if (!$this->stateConnected) { $this->result = $this->buildErrorResult(Status_HTTPFutureResponseStatusTransport::ERROR_CONNECTION_REFUSED); } else { if (!$this->stateWriteComplete) { $this->result = $this->buildErrorResult(Status_HTTPFutureResponseStatusTransport::ERROR_CONNECTION_FAILED); } else { $this->result = $this->parseRawHTTPResponse($this->response); } } } $profiler = PhutilServiceProfiler::getInstance(); $profiler->endServiceCall($this->profilerCallID, array()); return true; }