(self, pkt)
Concatenate a single BlocksatPkt within a concatenation cache
Concatenate a single BlocksatPkt within a concatenation cache
Concatenate a single BlocksatPkt within a concatenation cache
def _concat_pkt(self, pkt):
        """Concatenate a single BlocksatPkt within a concatenation cache"""
        seq_num = pkt.seq_num

        # If it's an out-of-order packet, re-compute the concatenated
        # version. Otherwise, just append directly to the cache.
        if (self.frag_map[seq_num]['high_frag'] is not None
                and pkt.frag_num < self.frag_map[seq_num]['high_frag']):

            concat_msg = bytearray()
            for i_frag, frag in sorted(
                    self.frag_map[seq_num]['frags'].items()):
                concat_msg += frag.payload

            self.frag_map[seq_num]['concat'] = concat_msg
        else:
            self.frag_map[seq_num]['concat'] += pkt.payload
def _concat_pkt ( self , pkt ) : seq_num = pkt . seq_num # If it's an out-of-order packet, re-compute the concatenated # version. Otherwise, just append directly to the cache. if ( self . frag_map [ seq_num ] [ 'high_frag' ] is not None and pkt . frag_num < self . frag_map [ seq_num ] [ 'high_frag' ] ) : concat_msg = bytearray ( ) for i_frag , frag in sorted ( self . frag_map [ seq_num ] [ 'frags' ] . items ( ) ) : concat_msg += frag . payload self . frag_map [ seq_num ] [ 'concat' ] = concat_msg else : self . frag_map [ seq_num ] [ 'concat' ] += pkt . payload