DoraRPC\Client::doRequest PHP Метод

doRequest() приватный Метод

private doRequest ( $sendData, $type )
    private function doRequest($sendData, $type)
    {
        //get client obj
        try {
            $client = $this->getClientObj();
        } catch (\Exception $e) {
            $data = Packet::packFormat($e->getMessage(), $e->getCode());
            $data["guid"] = $this->guid;
            return $data;
        }
        $ret = $client->send($sendData);
        //ok fail
        if (!$ret) {
            $errorcode = $client->errCode;
            //destroy error client obj to make reconncet
            //self::$client[$this->currentClientKey]->close();
            unset(self::$client[$this->currentClientKey]);
            // mark the current connection cannot be used, try another channel
            $this->serverConfigBlock[$this->connectGroup][$this->currentClientKey] = 1;
            if ($errorcode == 0) {
                $msg = "connect fail.check host dns.";
                $errorcode = -1;
                $packet = Packet::packFormat($msg, $errorcode);
            } else {
                $msg = \socket_strerror($errorcode);
                $packet = Packet::packFormat($msg, $errorcode);
            }
            return $packet;
        }
        //if the type is async result will record the guid and client handle
        if ($type == DoraConst::SW_MODE_ASYNCRESULT_MULTI || $type == DoraConst::SW_MODE_ASYNCRESULT_SINGLE) {
            self::$asynclist[$this->guid] = $client;
        }
        //recive the response
        $data = $this->waitResult($client);
        $data["guid"] = $this->guid;
        return $data;
    }