def snapshot(self):
        """
        This is used mostly as a way to keep the cipher state and the seq_num.
        """
        snap = connState(connection_end=self.connection_end,
                         read_or_write=self.row,
                         seq_num=self.seq_num,
                         compression_alg=type(self.compression),
                         ciphersuite=type(self.ciphersuite),
                         tls_version=self.tls_version)
        snap.cipher = self.cipher.snapshot()
        if self.hmac:
            snap.hmac.key = self.hmac.key
        return snap
def snapshot ( self ) : snap = connState ( connection_end = self . connection_end , read_or_write = self . row , seq_num = self . seq_num , compression_alg = type ( self . compression ) , ciphersuite = type ( self . ciphersuite ) , tls_version = self . tls_version ) snap . cipher = self . cipher . snapshot ( ) if self . hmac : snap . hmac . key = self . hmac . key return snap
This is used mostly as a way to keep the cipher state and the seq_num.