def invoke_command(self, *args):
        # create a request descriptor
        resend = True
        sendcount = -1
        lastreplycode = -1
        self.commandnumber += 1
        clientmsg = create_message(MSG_CLIENTREQUEST, self.me,
                                   {FLD_PROPOSAL: Proposal(self.me, self.commandnumber, args),
                                    FLD_TOKEN: self.token,
                                    FLD_CLIENTBATCH: False})
        while True:
            sendcount += 1
            clientmsg[FLD_SENDCOUNT] = sendcount
            # send the clientrequest
            if resend:
                success = self.conn.send(clientmsg)
                if not success:
                    self.reconfigure()
                    continue
                resend = False
        # Receive reply
            try:
                for reply in self.conn.received_bytes():
                    if reply and reply.type == MSG_CLIENTREPLY:
                        if reply.replycode == CR_OK:
                            return reply.reply
                        elif reply.replycode == CR_UNBLOCK:
                            # actionable response, wake up the thread
                            assert lastreplycode == CR_BLOCK, "unblocked thread not previously blocked"
                            return reply.reply
                        elif reply.replycode == CR_EXCEPTION:
                            raise Exception(pickle.loads(reply.reply))
                        elif reply.replycode == CR_INPROGRESS or reply.replycode == CR_BLOCK:
                            # the thread is already waiting, no need to do anything
                            lastreplycode = reply.replycode
                            # go wait for another message
                            continue
                        elif reply.replycode == CR_REJECTED or reply.replycode == CR_LEADERNOTREADY:
                            resend = True
                            self.reconfigure()
                            continue
                        else:
                            print "Unknown Client Reply Code."
            except ConnectionError:
                resend = True
                self.reconfigure()
                continue
            except __HOLE__:
                self._graceexit()
dataset/ETHPy150Open denizalti/concoord/concoord/clientproxy.py/ClientProxy.invoke_command