def handle_message(self, msg): print "get inquery" """This function is called whenever the node recives a message bound for this service""" """Return True if message is handled correctly Return False if things go horribly wrong """ if msg.service != self.service_id: return False start = msg.get_content("start") end = msg.get_content("end") N = msg.get_content("N") #record = msg.get_content("server_list") #linkset = msg.get_content("link_list") if not msg.reply_to == self.owner: if not hash_util.hash_between(self.owner.key,start,end): sucessor_cheat = hash_util.generate_lookup_key_with_index(self.owner.key,0) msg.origin_node = self.owner msg.destination_key = sucessor_cheat #record.append(str(self.owner)) #linkset[str(node.thisNode)] = self.get_my_links() #msg.add_content("server_list", record) #msg.add_content("link_list",linkset) msg.add_content("N",N+1) self.send_message(msg, None) else: msg.destination_key = msg.reply_to.key self.send_message(msg, msg.reply_to) else: now = time.time() print "render inquery:", now - msg.start_time print N
def handle_message(self, msg): print "get inquery" """This function is called whenever the node recives a message bound for this service""" """Return True if message is handled correctly Return False if things go horribly wrong """ if msg.service != self.service_id: return False start = msg.get_content("start") end = msg.get_content("end") N = msg.get_content("N") #record = msg.get_content("server_list") #linkset = msg.get_content("link_list") if not msg.reply_to == self.owner: if not hash_util.hash_between(self.owner.key, start, end): sucessor_cheat = hash_util.generate_lookup_key_with_index( self.owner.key, 0) msg.origin_node = self.owner msg.destination_key = sucessor_cheat #record.append(str(self.owner)) #linkset[str(node.thisNode)] = self.get_my_links() #msg.add_content("server_list", record) #msg.add_content("link_list",linkset) msg.add_content("N", N + 1) self.send_message(msg, None) else: msg.destination_key = msg.reply_to.key self.send_message(msg, msg.reply_to) else: now = time.time() print "render inquery:", now - msg.start_time print N
def start_inquery(self): sucessor_cheat = hash_util.generate_lookup_key_with_index(self.owner.key, 0) new_query = Toplogy_Poll_Message(self.owner, sucessor_cheat) linkset = {str(node.thisNode): self.get_my_links()} new_query.add_content("link_list", linkset) self.send_message(new_query) print "Send Inquery"
def start_inquery(self): sucessor_cheat = hash_util.generate_lookup_key_with_index(self.owner.key,0) new_query = Toplogy_Poll_Message(self.owner,sucessor_cheat) #linkset = {str(node.thisNode): self.get_my_links()} new_query.add_content("N",1) self.send_message(new_query, None) print "Send Inquery" self.last_start_time = time.time()
def start_inquery(self): sucessor_cheat = hash_util.generate_lookup_key_with_index( self.owner.key, 0) new_query = Toplogy_Poll_Message(self.owner, sucessor_cheat) #linkset = {str(node.thisNode): self.get_my_links()} new_query.add_content("N", 1) self.send_message(new_query, None) print "Send Inquery" self.last_start_time = time.time()