lib/shadowsocks/connection.rb in shadowsocks-0.5 vs lib/shadowsocks/connection.rb in shadowsocks-0.6
- old
+ new
@@ -1,8 +1,8 @@
module Shadowsocks
class Connection < EventMachine::Connection
- BackpressureLevel = 2097152 # 2m
+ BackpressureLevel = 524288 # 512k
attr_accessor :crypto
private
@@ -16,13 +16,13 @@
def over_pressure?
remote.get_outbound_data_size > BackpressureLevel
end
- def outbound_checker
+ def outbound_scheduler
if over_pressure?
pause unless paused?
- EM.add_timer(1) { outbound_checker }
+ EM.add_timer(0.2) { outbound_scheduler }
else
resume if paused?
end
end
end