Esempio n. 1
0
 public static function BlockConnDrone($hasTid = false)
 {
     global $language;
     $requestData = false;
     $dealed = true;
     if (!$hasTid) {
         if (self::$_nonBlock) {
             return;
         }
         if (0 == self::$_requestStatus or 1 == self::$_requestStatus) {
             if (HYP_IPC_MODE === "mysql") {
                 self::$_db->close();
                 $a = self::mysql_recv_block($requestData);
             } else {
                 //if (HYP_IPC_MODE !== "namepipe"){
                 $a = HYP_IPC::task_recv(self::$_tid, $requestData, self::$_drones_num);
                 $dealed = false;
             }
         } else {
             return;
         }
     } else {
         $a = self::mysql_recv_block($requestData);
     }
     if (1 == $a) {
         //success
         foreach ($requestData as $c_cid => $c) {
             $uniqu = self::$_instance[$c_cid];
             //$c_cid.'_'.$moduleId;
             $status = $c['status'];
             if (2 == $c['status']) {
                 self::SetDataCharset($c['data']);
                 self::$_result[$c_cid]['content'] = HYP_SCRIPT::parser($c['data'], $c_cid, self::$_mid, $uniqu, self::$_result[$c_cid]['lasterror'], $language);
             } else {
                 if (isset($language['request_status_' . $status])) {
                     self::$_result[$c_cid]['lasterror'] = $language['request_status_' . $status];
                 } else {
                     self::$_result[$c_cid]['lasterror'] = $language['unkown_status'] . $status;
                 }
             }
             if (true !== $dealed) {
                 $dealed[$c_cid] = $c_cid;
             }
         }
         if (is_array($dealed)) {
             $queryHead = 'update ' . self::$_mysql_ini['prefix'] . 'online_task set dealed=1 where tid=\'' . self::$_tid . '\' and (';
             self::batch_mysql_query($queryHead, 'cid', $dealed, self::$_db);
         }
     } elseif (0 == $a) {
         //timeout
         $lasterror[] = $language['ipc_recv_timeout'];
     } else {
         //fail
         $lasterror[] = $language['ipc_recv_fail'];
     }
 }