Esempio n. 1
0
 private function fetchTaskStatus($taskId)
 {
     $socketPath = sprintf(self::PTRACK_PATH_TEMPLATE, $taskId);
     $dumpPath = sprintf(self::PTRACK_DUMP_PATH, md5($socketPath));
     $taskStatus = FALSE;
     $errno = 0;
     $errstr = "";
     $socket = $this->phpWrapper->fsockopen('unix://' . $socketPath, -1, $errno, $errstr);
     if ($socket === FALSE) {
         $socketPathExists = $errno != 2;
         if ($socketPathExists) {
             $this->log->error(sprintf('%s: Socket %s exists, but open failed: errno %d, errstr %s', __CLASS__, $socketPath, $errno, $errstr));
         }
         $taskStatus = $this->fetchDumpFile($dumpPath);
     } else {
         $this->sendMessage($socket, self::TY_QUERY);
         $taskStatus = $this->recvMessage($socket);
         $this->phpWrapper->fclose($socket);
     }
     return $taskStatus;
 }