class Vines::XmppServer
The main starting point for the XMPP server process. Starts the EventMachine processing loop and registers the XMPP protocol handler with the ports defined in the server configuration file.
Public Class Methods
new(config)
click to toggle source
# File lib/vines/xmpp_server.rb, line 11 def initialize(config) @config = config end
Public Instance Methods
start()
click to toggle source
# File lib/vines/xmpp_server.rb, line 15 def start log.info('XMPP server started') at_exit { log.fatal('XMPP server stopped') } EM.epoll EM.kqueue u = UPnP::UPnP.new log.info('UPnP started') EM.run do @config.ports.each do |port| forwarded = true begin u.addPortMapping(port.settings[:port], port.settings[:port], "TCP", port.stream.to_s, Kit.local_ip) rescue UPnP::UPnPException log.warn("Cannot forward port #{port.settings[:port]}") forwarded = false end log.info("Forwarded port #{port.settings[:port]}") if forwarded port.start end end end