예제 #1
0
파일: dsr.py 프로젝트: uwacits4419/DSR
 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
예제 #2
0
파일: dsr.py 프로젝트: uwacits4419/DSR
 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
예제 #3
0
파일: dsr.py 프로젝트: atyndall/cits4419
 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
예제 #4
0
파일: dsr.py 프로젝트: atyndall/cits4419
 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
예제 #5
0
파일: dsr.py 프로젝트: atyndall/cits4419
  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()))
예제 #6
0
파일: dsr.py 프로젝트: uwacits4419/DSR
    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()))