# File lib/net/ssh/transport/state.rb, line 137 137: def reset! 138: @packets = @blocks = 0 139: 140: @max_packets ||= 1 << 31 141: 142: @block_size = cipher.name == "RC4" ? 8 : cipher.block_size 143: 144: if max_blocks.nil? 145: # cargo-culted from openssh. the idea is that "the 2^(blocksize*2) 146: # limit is too expensive for 3DES, blowfish, etc., so enforce a 1GB 147: # limit for small blocksizes." 148: if @block_size >= 16 149: @max_blocks = 1 << (@block_size * 2) 150: else 151: @max_blocks = (1 << 30) / @block_size 152: end 153: 154: # if a limit on the # of bytes has been given, convert that into a 155: # minimum number of blocks processed. 156: 157: if rekey_limit 158: @max_blocks = [@max_blocks, rekey_limit / @block_size].min 159: end 160: end 161: 162: cleanup 163: end