Class: Falcon::Listener

Inherits:
Object
  • Object
show all
Defined in:
lib/falcon/listener.rb

Overview

Describes a bound listener for a Falcon server.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, scheme:, protocols:, endpoint:) ⇒ Listener

Initialize a bound listener.



14
15
16
17
18
19
20
21
# File 'lib/falcon/listener.rb', line 14

def initialize(name:, scheme:, protocols:, endpoint:)
	@name = name
	@scheme = scheme
	@protocols = protocols.map(&:to_s).freeze
	@endpoint = endpoint
	@addresses = endpoint.sockets.map{|socket| socket.to_io.local_address}.freeze
	freeze
end

Instance Attribute Details

#addressesObject (readonly)

Returns the value of attribute addresses.



36
37
38
# File 'lib/falcon/listener.rb', line 36

def addresses
  @addresses
end

#endpointObject (readonly)

Returns the value of attribute endpoint.



33
34
35
# File 'lib/falcon/listener.rb', line 33

def endpoint
  @endpoint
end

#nameObject (readonly)

Returns the value of attribute name.



24
25
26
# File 'lib/falcon/listener.rb', line 24

def name
  @name
end

#protocolsObject (readonly)

Returns the value of attribute protocols.



30
31
32
# File 'lib/falcon/listener.rb', line 30

def protocols
  @protocols
end

#schemeObject (readonly)

Returns the value of attribute scheme.



27
28
29
# File 'lib/falcon/listener.rb', line 27

def scheme
  @scheme
end

#The application protocol scheme.(applicationprotocolscheme.) ⇒ Object (readonly)



27
# File 'lib/falcon/listener.rb', line 27

attr_reader :scheme

#The bound addresses.(boundaddresses.) ⇒ Object (readonly)



36
# File 'lib/falcon/listener.rb', line 36

attr_reader :addresses

#The logical listener name.(logicallistenername.) ⇒ Object (readonly)



24
# File 'lib/falcon/listener.rb', line 24

attr_reader :name

#The supported application protocol names.(supportedapplicationprotocolnames.) ⇒ Object (readonly)



30
# File 'lib/falcon/listener.rb', line 30

attr_reader :protocols

Instance Method Details

#closeObject

Close the bound endpoint.



39
40
41
# File 'lib/falcon/listener.rb', line 39

def close
	@endpoint.close
end

#The bound endpoint.=(boundendpoint. = (value)) ⇒ Object



33
# File 'lib/falcon/listener.rb', line 33

attr_reader :endpoint