Sha256: 75bf292554caf0418ddf9a0ba902cb00a6f0dc0deb2043d763da08b57ee9f74d
Contents?: true
Size: 538 Bytes
Versions: 7
Compression:
Stored size: 538 Bytes
Contents
module Shadowsocks class Connection < EventMachine::Connection BackpressureLevel = 524288 # 512k attr_accessor :crypto private def encrypt(buf) crypto.encrypt(buf) end def decrypt(buf) crypto.decrypt(buf) end def over_pressure? remote.get_outbound_data_size > BackpressureLevel end def outbound_scheduler if over_pressure? pause unless paused? EM.add_timer(0.2) { outbound_scheduler } else resume if paused? end end end end
Version data entries
7 entries across 7 versions & 1 rubygems