# File rbot/ircbot.rb, line 213
  def mainloop
    socket_timeout = 0.2
    reconnect_wait = 5
    
    while true
      connect
      
      while true
        if @socket.select socket_timeout
          break unless reply = @socket.gets
          @client.process reply
        end
        @timer.tick
      end
      
      puts "disconnected"
      @channels.clear
      
      puts "waiting to reconnect"
      sleep reconnect_wait
    end
  end