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

      @max_packets ||= 1 << 31

      @block_size = cipher.name == "RC4" ? 8 : cipher.block_size

      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 @block_size >= 16
          @max_blocks = 1 << (@block_size * 2)
        else
          @max_blocks = (1 << 30) / @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 / @block_size].min
        end
      end

      cleanup
    end