From 35601ffcbdd7dd6954bd10cc93955f9ae3825215 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 21 Jul 2006 09:31:33 +0000 Subject: Small improvement on the byterate-based throttling code --- lib/rbot/ircsocket.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') 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})" -- cgit v1.2.3