class Vines::Config::Port

Attributes

config[R]
settings[R]
stream[R]

Public Class Methods

new(config, host, port, &block) click to toggle source
# File lib/vines/config/port.rb, line 16
def initialize(config, host, port, &block)
  @config, @settings = config, {}
  instance_eval(&block) if block
  defaults = {:host => host, :port => port,
    :max_resources_per_account => 5, :max_stanza_size => 128 * 1024}
  @settings = defaults.merge(@settings)
end

Public Instance Methods

max_stanza_size(max=nil) click to toggle source
# File lib/vines/config/port.rb, line 24
def max_stanza_size(max=nil)
  if max
    # rfc 6120 section 13.12
    @settings[:max_stanza_size] = [10000, max].max
  else
    @settings[:max_stanza_size]
  end
end
start() click to toggle source
# File lib/vines/config/port.rb, line 33
def start
  type = stream.name.split('::').last.downcase
  log.info("Accepting #{type} connections on #{host}:#{port}")
  EventMachine::start_server(host, port, stream, config)
end