Changeset 5aa23b55a4547257580d047118ec4019a93499f7

Show
Ignore:
Timestamp:
08/19/08 22:30:14 (3 months ago)
Author:
Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
git-committer:
Giuseppe Bilotta <giuseppe.bilotta@gmail.com> 1219170614 +0200
git-parent:

[43b5cd9777cc13c6d3ac14a4015a0c8e8d9e5b50]

git-author:
Giuseppe Bilotta <giuseppe.bilotta@gmail.com> 1219170614 +0200
Message:

IRC socket: minor flood_send logic fixes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lib/rbot/ircsocket.rb

    r43b5cd9 r5aa23b5  
    397397        begin 
    398398          now = Time.now 
    399          flood_delay = @flood_send - MAX_IRC_SEND_PENALTY - now 
    400          delay = [flood_delay, 0].max 
    401          if delay > 0 
     399          flood_delay = @flood_send - MAX_IRC_SEND_PENALTY - now 
     400          delay = [flood_delay, 0].max 
     401          if delay > 0 
    402402            debug "sleep(#{delay}) # (f: #{flood_delay})" 
    403403            sleep(delay) 
    404404          end 
    405405          msg = @sendq.shift 
    406           now = Time.now 
    407           @flood_send = now if @flood_send < now 
    408406          debug "got #{msg.inspect} from queue, sending" 
    409407          emergency_puts(msg, true) 
     
    428426          # some circumstances 
    429427          actual = @filter.out(message) + "\n" 
     428          now = Time.new 
    430429          @sock.syswrite actual 
    431           @last_send = Time.new 
     430          @last_send = now 
     431          @flood_send = now if @flood_send < now 
    432432          @flood_send += message.irc_send_penalty if penalty 
    433433          @lines_sent += 1