hpimdm/Neighbor.py
def recv_reliable_packet(self, sn, tree, boot_time):
        """
        Decide if a packet received from this neighbor should be processed
        """
        if boot_time < self.time_of_boot:
            return False
        elif boot_time > self.time_of_boot:
            self.time_of_boot = boot_time
            self.neighbor_snapshot_sn = 0
            self.start_sync_process()
            return False

        if self.neighbor_state == Unknown or self.current_sync_sn == 0:
            #do not interpret control message without having the guarantee of
            # correct <NeighborBootTime; NeighborSnapshotSN> pair
            return False

        last_received_sn = self.last_sequence_number.get(tree, 0)

        if sn <= self.neighbor_snapshot_sn or sn <= self.checkpoint_sn:
            # dont deliver to application
            print("RCVD ", sn)
            print("NSSN ", self.neighbor_snapshot_sn)
            return False
        elif sn >= last_received_sn:
            (source, group) = tree
            packet = self.contact_interface.create_ack_msg(my_boot_time=self.contact_interface.time_of_boot, sn=sn,
                                                           source=source, group=group,
                                                           neighbor_boot_time=boot_time,
                                                           neighbor_snapshot_sn=self.neighbor_snapshot_sn,
                                                           my_snapshot_sn=self.my_snapshot_sequencer)
            self.contact_interface.send(packet, self.ip)

            if sn > last_received_sn:
                # update most recent sn received from this neighbor
                self.last_sequence_number[tree] = sn

                # deliver to application
                return True
        # dont deliver to application
        print("RCVD ", sn)
        print("LAST TREE SN ", last_received_sn)
        return False

        Decide if a packet received from this neighbor should be processed
        
Decide if a packet received from this neighbor should be processed
Decide if a packet received from this neighbor should be processed
def recv_reliable_packet(self, sn, tree, boot_time):
        if boot_time < self.time_of_boot:
            return False
        elif boot_time > self.time_of_boot:
            self.time_of_boot = boot_time
            self.neighbor_snapshot_sn = 0
            self.start_sync_process()
            return False
        if self.neighbor_state == Unknown or self.current_sync_sn == 0:
            return False
        last_received_sn = self.last_sequence_number.get(tree, 0)
        if sn <= self.neighbor_snapshot_sn or sn <= self.checkpoint_sn:
            print("RCVD ", sn)
            print("NSSN ", self.neighbor_snapshot_sn)
            return False
        elif sn >= last_received_sn:
            (source, group) = tree
            packet = self.contact_interface.create_ack_msg(my_boot_time=self.contact_interface.time_of_boot, sn=sn,
                                                           source=source, group=group,
                                                           neighbor_boot_time=boot_time,
                                                           neighbor_snapshot_sn=self.neighbor_snapshot_sn,
                                                           my_snapshot_sn=self.my_snapshot_sequencer)
            self.contact_interface.send(packet, self.ip)
            if sn > last_received_sn:
                self.last_sequence_number[tree] = sn
                return True
        print("RCVD ", sn)
        print("LAST TREE SN ", last_received_sn)
        return False
def recv_reliable_packet ( self , sn , tree , boot_time ) : if boot_time < self . time_of_boot : return False elif boot_time > self . time_of_boot : self . time_of_boot = boot_time self . neighbor_snapshot_sn = 0 self . start_sync_process ( ) return False if self . neighbor_state == Unknown or self . current_sync_sn == 0 : return False last_received_sn = self . last_sequence_number . get ( tree , 0 ) if sn <= self . neighbor_snapshot_sn or sn <= self . checkpoint_sn : print ( "RCVD " , sn ) print ( "NSSN " , self . neighbor_snapshot_sn ) return False elif sn >= last_received_sn : ( source , group ) = tree packet = self . contact_interface . create_ack_msg ( my_boot_time = self . contact_interface . time_of_boot , sn = sn , source = source , group = group , neighbor_boot_time = boot_time , neighbor_snapshot_sn = self . neighbor_snapshot_sn , my_snapshot_sn = self . my_snapshot_sequencer ) self . contact_interface . send ( packet , self . ip ) if sn > last_received_sn : self . last_sequence_number [ tree ] = sn return True print ( "RCVD " , sn ) print ( "LAST TREE SN " , last_received_sn ) return False
Decide if a packet received from this neighbor should be processed
Decide if a packet received from this neighbor should be processed
"""
        Decide if a packet received from this neighbor should be processed
        """ #do not interpret control message without having the guarantee of # correct <NeighborBootTime; NeighborSnapshotSN> pair # dont deliver to application # update most recent sn received from this neighbor # deliver to application # dont deliver to application
self
sn
tree
boot_time