# File lib/net/ssh/transport/state.rb, line 116
    def reset!
      @packets = @blocks = 0

      @max_packets ||= 1 << 31

      if max_blocks.nil?
        # cargo-culted from openssh. the idea is that "the 2^(blocksize*2)
        # limit is too expensive for 3DES, blowfish, etc., so enforce a 1GB
        # limit for small blocksizes."

        if cipher.block_size >= 16
          @max_blocks = 1 << (cipher.block_size * 2)
        else
          @max_blocks = (1 << 30) / cipher.block_size
        end

        # if a limit on the # of bytes has been given, convert that into a
        # minimum number of blocks processed.

        if rekey_limit
          @max_blocks = [@max_blocks, rekey_limit / cipher.block_size].min
        end
      end

      cleanup
    end