IOWatcher
Listeners wait for incoming connections. When a listener receives a connection it fires the on_connection event with the newly accepted socket as a parameter.
Close the listener
# File lib/cool.io/listener.rb, line 25 def close detach if attached? @listen_socket.close end
Coolio callback for handling new connections
# File lib/cool.io/listener.rb, line 39 def on_readable begin on_connection @listen_socket.accept_nonblock rescue Errno::EAGAIN, Errno::ECONNABORTED # EAGAIN can be triggered here if the socket is shared between # multiple processes and a thundering herd is woken up to accept # one connection, only one process will get the connection and # the others will be awoken. # ECONNABORTED is documented in accept() manpages but modern TCP # stacks with syncookies and/or accept()-filtering for DoS # protection do not see it. In any case this error is harmless # and we should instead spend our time with clients that follow # through on connection attempts. end end
Generated with the Darkfish Rdoc Generator 2.