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

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

random get config key
private getConfigObjKey ( )
    private function getConfigObjKey()
    {
        if (!isset($this->serverConfig[$this->connectGroup])) {
            throw new \Exception("there is no one server can connect", 100010);
        }
        // if there is no config can use clean up the block list
        if (isset($this->serverConfigBlock[$this->connectGroup]) && count($this->serverConfig[$this->connectGroup]) <= count($this->serverConfigBlock[$this->connectGroup])) {
            //clean up the block list
            $this->serverConfigBlock[$this->connectGroup] = array();
        }
        //if not specified the ip and port random get one
        do {
            //get one config by random
            $key = array_rand($this->serverConfig[$this->connectGroup]);
            //if not on the block list.
            if (!isset($this->serverConfigBlock[$this->connectGroup][$key])) {
                return $key;
            }
        } while (count($this->serverConfig[$this->connectGroup]) > count($this->serverConfigBlock));
        throw new \Exception("there is no one server can connect", 100010);
    }