Class: Qpid::Proton::Listener
- Inherits:
-
Object
- Object
- Qpid::Proton::Listener
- Defined in:
- lib/core/listener.rb
Overview
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.
Direct Known Subclasses
Defined Under Namespace
Classes: Handler
Instance Attribute Summary collapse
-
#condition ⇒ Condition
readonly
The error condition if there is one.
-
#container ⇒ Container
readonly
The listener’s container.
Instance Method Summary collapse
-
#close(error = nil)
Initiate closing the the listener.
-
#closed? ⇒ Boolean
True if the listening socket is fully closed.
-
#port
Get the IP port used by the listener.
-
#to_io
Get the IO server socket used by the listener.
Instance Attribute Details
#condition ⇒ Condition (readonly)
Returns The error condition if there is one.
64 65 66 |
# File 'lib/core/listener.rb', line 64 def condition @condition end |
#container ⇒ Container (readonly)
Returns The listener’s container.
61 62 63 |
# File 'lib/core/listener.rb', line 61 def container @container end |
Instance Method Details
#close(error = nil)
Initiate closing the the listener. It will not be fully #closed? until its Qpid::Proton::Listener::Handler#on_close is called by the Container
69 70 71 72 73 74 75 |
# File 'lib/core/listener.rb', line 69 def close(error=nil) return if closed? || @closing @closing = true @condition ||= Condition.convert error @io.close_read rescue nil # Force Container IO.select to wake with listener readable. nil end |
#closed? ⇒ Boolean
True if the listening socket is fully closed
84 |
# File 'lib/core/listener.rb', line 84 def closed?() @io.closed?; end |
#port
Get the IP port used by the listener
81 |
# File 'lib/core/listener.rb', line 81 def port() to_io.addr[1]; end |
#to_io
Get the IO server socket used by the listener
78 |
# File 'lib/core/listener.rb', line 78 def to_io() @io; end |