Method: Diameter::Stack#initialize

Defined in:
lib/diameter/stack.rb

#initialize(host, realm, opts = {}) ⇒ Stack

Note:

The stack does not advertise any applications to peers by default - #add_handler must be called early on.

Stack constructor.

Parameters:

  • The Diameter Identity of this stack (for the Origin-Host AVP).

  • The Diameter realm of this stack (for the Origin-Realm AVP).

  • (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • timeout (Fixnum) — default: 60

    The number of seconds to wait for an answer before notifying the caller of a timeout and forgetting about the request.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/diameter/stack.rb', line 28

def initialize(host, realm, opts={})
  @local_host = host
  @local_realm = realm

  @auth_apps = []
  @acct_apps = []

  @pending_ete = {}

  @tcp_helper = TCPStackHelper.new(self)
  @peer_table = {}
  @handlers = {}

  @answer_timeout = opts.fetch(:timeout, 60)

  @threadpool = Concurrent::ThreadPoolExecutor.new(
                                                   min_threads: 5,
                                                   max_threads: 5,
                                                   max_queue: 1,
                                                   fallback_policy: :caller_runs
                                                   )

  @res = Dnsruby::Resolver.new
  Diameter.logger.log(Logger::INFO, 'Stack initialized')
end