Mercurial > prosody-hg
comparison core/hostmanager.lua @ 1095:cad4205f4925
hostmanager: Reduce log output at startup to 'debug'
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sat, 02 May 2009 22:02:43 +0100 |
| parents | 1359492f45d7 |
| children | fa48e69c4786 |
comparison
equal
deleted
inserted
replaced
| 1094:a619525fed5d | 1095:cad4205f4925 |
|---|---|
| 7 | 7 |
| 8 local pairs = pairs; | 8 local pairs = pairs; |
| 9 | 9 |
| 10 module "hostmanager" | 10 module "hostmanager" |
| 11 | 11 |
| 12 local hosts_loaded_once; | |
| 13 | |
| 12 local function load_enabled_hosts(config) | 14 local function load_enabled_hosts(config) |
| 13 local defined_hosts = config or configmanager.getconfig(); | 15 local defined_hosts = config or configmanager.getconfig(); |
| 14 | 16 |
| 15 for host, host_config in pairs(defined_hosts) do | 17 for host, host_config in pairs(defined_hosts) do |
| 16 if host ~= "*" and (host_config.core.enabled == nil or host_config.core.enabled) then | 18 if host ~= "*" and (host_config.core.enabled == nil or host_config.core.enabled) then |
| 17 activate(host, host_config); | 19 activate(host, host_config); |
| 18 end | 20 end |
| 19 end | 21 end |
| 20 eventmanager.fire_event("hosts-activated", defined_hosts); | 22 eventmanager.fire_event("hosts-activated", defined_hosts); |
| 23 hosts_loaded_once = true; | |
| 21 end | 24 end |
| 22 | 25 |
| 23 eventmanager.add_event_hook("server-starting", load_enabled_hosts); | 26 eventmanager.add_event_hook("server-starting", load_enabled_hosts); |
| 24 | 27 |
| 25 function activate(host, host_config) | 28 function activate(host, host_config) |
| 26 hosts[host] = {type = "local", connected = true, sessions = {}, host = host, s2sout = {} }; | 29 hosts[host] = {type = "local", connected = true, sessions = {}, host = host, s2sout = {} }; |
| 27 log("info", "Activated host: %s", host); | 30 log((hosts_loaded_once and "info") or "debug", "Activated host: %s", host); |
| 28 eventmanager.fire_event("host-activated", host, host_config); | 31 eventmanager.fire_event("host-activated", host, host_config); |
| 29 end | 32 end |
| 30 | 33 |
| 31 function deactivate(host) | 34 function deactivate(host) |
| 32 local host_session = hosts[host]; | 35 local host_session = hosts[host]; |
