def __make_packet_o(self, type, path, contents, originator, origantorNode): pkt = Packet() pkt.type = type pkt.path = path pkt.contents = contents pkt.id = self.next_packet_id pkt.originatorID = originator pkt.originatorNodeID = origantorNode self.next_packet_id += 1 return pkt
def __make_packet(self, type, path, contents): pkt = Packet() pkt.type = type pkt.path = path pkt.contents = contents pkt.id = self.next_packet_id pkt.originatorID = pkt.id pkt.originatorNodeID = self.ID self.next_packet_id += 1 return pkt
def __make_packet_o(self, type, path, contents, originator, origantorNode): pkt = Packet() pkt.type = type pkt.path = path pkt.contents = contents pkt.id = self.next_packet_id pkt.originatorID = originator pkt.originatorNodeID = origantorNode self.next_packet_id += 1 return pkt
def __make_packet(self, type, path, contents): pkt = Packet() pkt.type = type pkt.path = path pkt.contents = contents pkt.id = self.next_packet_id pkt.originatorID = pkt.id pkt.originatorNodeID = self.ID self.next_packet_id += 1 return pkt
def receive_packet(self, pkt): a = Packet.from_str(pkt) #dont add self messages to route cache (this should never happen, but just in case) if int(a.fromID) != self.ID and len(a.path) > 1: #add new paths to route cache self.__route_cache.offer_route(a.path) #ignore messages that arent for us if int(a.toID) != self.ID and int(a.toID) != -1 : return #ignore self-self messages if int(a.fromID) == self.ID: return self.__receive_queue.append(a) self.__log("Receieved a packet {}".format(a.pretty_print()))
def receive_packet(self, pkt): a = Packet.from_str(pkt) #dont add self messages to route cache (this should never happen, but just in case) if int(a.fromID) != self.ID and len(a.path) > 1: #add new paths to route cache self.__route_cache.offer_route(a.path) #ignore messages that arent for us if int(a.toID) != self.ID and int(a.toID) != -1: return #ignore self-self messages if int(a.fromID) == self.ID: return self.__receive_queue.append(a) self.__log("Receieved a packet {}".format(a.pretty_print()))