Class: Qpid::Proton::Listener

Inherits:
Object
  • Object
show all
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

Container::ListenTask

Defined Under Namespace

Classes: Handler

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#conditionCondition (readonly)

Returns The error condition if there is one.

Returns:

  • (Condition)

    The error condition if there is one



64
65
66
# File 'lib/core/listener.rb', line 64

def condition
  @condition
end

#containerContainer (readonly)

Returns The listener's container.

Returns:



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

Parameters:

  • error (Condition) (defaults to: nil)

    Optional error condition.



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

Returns:

  • (Boolean)


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