Method: IRCConnection.do_one_loop

Defined in:
lib/vendor/irc/lib/IRCConnection.rb

.do_one_loopObject

Makes one single loop pass, checking all sockets for data to read, and yields the data to the sockets event handler.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/vendor/irc/lib/IRCConnection.rb', line 85

def IRCConnection.do_one_loop
  read_sockets = select(@@readsockets, nil, nil, 0.1);
  if !read_sockets.nil?
    read_sockets[0].each {|sock|
      if sock.eof? && sock == @@socket
        remove_IO_socket(sock)
        sleep 10
        handle_connection(@server, @port, @nick, @realname)
      else
        yield @@events[sock.object_id.to_i].call(sock)
      end
    }
  end
  if @@output_buffer.length > 0
    timer = Time.now.to_f
    if (timer > @@last_send + @@message_delay)
      message = @@output_buffer.shift();
      if !message.nil?
        IRCConnection.send_to_server(message);
        @@last_send = timer
      end
    end
  end
end