|
# File rbot/ircbot.rb, line 247
def mainloop
socket_timeout = 0.2
reconnect_wait = 5
while true
connect
begin
while true
if @socket.select socket_timeout
break unless reply = @socket.gets
@client.process reply
end
@timer.tick
end
rescue => e
puts "connection closed: #{e}"
puts e.backtrace.join("\n")
end
puts "disconnected"
@channels.clear
@socket.clearq
puts "waiting to reconnect"
sleep reconnect_wait
end
end
|