A listener for incoming connections.
Create with {Container#listen} or {Container#listen_io}. To control the handler and connection options applied to incoming connections, pass a {ListenerHandler} on creation.
@return [Condition] The error condition if there is one
@return [Container] The listener's container
# File lib/core/listener.rb, line 83 def initialize(io, handler, container) @io, @handler = io, handler @container = container end
Close the listener @param error [Condition] Optional error condition.
# File lib/core/listener.rb, line 68 def close(error=nil) @closing = true @condition ||= Condition.convert error @io.close_read rescue nil # Cause listener to wake out of IO.select nil end
Get the IP port used by the listener
# File lib/core/listener.rb, line 79 def port() to_io.addr[1]; end
Get the {IO} server socket used by the listener
# File lib/core/listener.rb, line 76 def to_io() @io; end