Sha256: 4ad76ce2a2d862b4731729cf96b35cbb34834f9c03c0244d96e60b096119f1be

Contents?: true

Size: 392 Bytes

Versions: 1

Compression:

Stored size: 392 Bytes

Contents

module Shadowsocks
  class Connection < EventMachine::Connection
    BackpressureLevel = 2097152 # 2m

    private

    def over_pressure?
      remote.get_outbound_data_size > BackpressureLevel
    end

    def outbound_checker
      if over_pressure?
        pause unless paused?
        EM.add_timer(1) { outbound_checker }
      else
        resume if paused?
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shadowsocks-0.3 lib/shadowsocks/connection.rb