def onRecReqVoteRPC(self,message):
     #print("("+str(State.dc_ID)+","+State.state+","+str(State.currentTerm)+'): Receive ReqVoteRPC from: '+\
           #str(message.candidateId)+" term"+str(message.term))
     
     if(StateController.eql(State.state,'follower')):
         reply=Follower.onRecReqVoteRPC(message)
     else:
         reply=Receiver.onRecReqVoteRPC(message)
     
     #print(reply.voteGranted)
     sender=Sender('RequestVoteRPCReply',reply)
     sender.send(self.dc_list[message.candidateId])
Esempio n. 2
0
    def onRecReqVoteRPC(self, message):
        #print("("+str(State.dc_ID)+","+State.state+","+str(State.currentTerm)+'): Receive ReqVoteRPC from: '+\
        #str(message.candidateId)+" term"+str(message.term))

        if (StateController.eql(State.state, 'follower')):
            reply = Follower.onRecReqVoteRPC(message)
        else:
            reply = Receiver.onRecReqVoteRPC(message)

        #print(reply.voteGranted)
        sender = Sender('RequestVoteRPCReply', reply)
        sender.send(self.dc_list[message.candidateId])