def recv_loop(self, *args):
        socketset = [self.socket]
        while True:
            try:
                needreconfig = False
                inputready,outputready,exceptready = select.select(socketset, [], socketset, 0)
                for s in inputready:
                    reply = self.conn.receive()
                    if reply is None:
                        needreconfig = True
                    elif reply and reply.type == MSG_CLIENTREPLY:
                        reqdesc = self.pendingops[reply.inresponseto]
                        with self.lock:
                            if reply.replycode == CR_OK or reply.replycode == CR_EXCEPTION or reply.replycode == CR_UNBLOCK:
                                # actionable response, wake up the thread
                                if reply.replycode == CR_UNBLOCK:
                                    assert reqdesc.lastcr == CR_BLOCK, "unblocked thread not previously blocked"
                                reqdesc.lastcr = reply.replycode
                                reqdesc.reply = reply
                                reqdesc.replyvalid = True
                                reqdesc.replyarrived.notify()
                            elif reply.replycode == CR_INPROGRESS or reply.replycode == CR_BLOCK:
                                # the thread is already waiting, no need to do anything
                                reqdesc.lastcr = reply.replycode
                            elif reply.replycode == CR_REJECTED or reply.replycode == CR_LEADERNOTREADY:
                                needreconfig = True
                            else:
                                print "should not happen -- unknown response type"

                while needreconfig:
                    if not self.trynewbootstrap():
                        raise ConnectionError("Cannot connect to any bootstrap")
                    needreconfig = False

                    # check if we need to re-send any pending operations
                    for commandno,reqdesc in self.pendingops.iteritems():
                        if not reqdesc.replyvalid and reqdesc.lastreplycr != CR_BLOCK:
                            reqdesc.sendcount += 1
                            reqdesc.cm[FLD_SENDCOUNT] = reqdesc.sendcount
                            if not self.conn.send(reqdesc.cm):
                                needreconfig = True
                            continue
            except __HOLE__:
                self._graceexit()
dataset/ETHPy150Open denizalti/concoord/concoord/blockingclientproxy.py/ClientProxy.recv_loop