diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-07-21 09:31:33 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-07-21 09:31:33 +0000 |
commit | 35601ffcbdd7dd6954bd10cc93955f9ae3825215 (patch) | |
tree | 7be82d7d9e7fecec833b317569659f8701b3d2dd | |
parent | bf14a3ee7ce032335ba7f3ee07dac283ea276147 (diff) |
Small improvement on the byterate-based throttling code
-rw-r--r-- | lib/rbot/ircsocket.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/rbot/ircsocket.rb b/lib/rbot/ircsocket.rb index b3c3dc8a..4ee3be23 100644 --- a/lib/rbot/ircsocket.rb +++ b/lib/rbot/ircsocket.rb @@ -162,8 +162,7 @@ module Irc @throttle_bytes = 0 if @throttle_bytes < 0 @last_throttle = now end - end - if @throttle_bytes == 0 + else @throttle_div = 1 end @throttle_bytes += more @@ -230,6 +229,8 @@ module Irc break if @sendq.empty? mess = @sendq[0] if @throttle_bytes == 0 or mess.length+@throttle_bytes < @bytes_per + debug "(flood protection: sending message of length #{mess.length})" + debug "(byterate: #{byterate}, throttle bytes: #{@throttle_bytes})" puts_critical(@sendq.shift) else debug "(flood protection: throttling message of length #{mess.length})" |