Software /
code /
prosody
Changeset
3587:d94aacb2771a
componentmanager, hostmanager, modulemanager, mod_component: Got rid of the useless hosts[*].connected property.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Wed, 10 Nov 2010 03:39:38 +0500 |
parents | 3586:78ed7ad330ab |
children | 3588:1e570ed17147 |
files | core/componentmanager.lua core/hostmanager.lua core/modulemanager.lua plugins/mod_component.lua |
diffstat | 4 files changed, 3 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/core/componentmanager.lua Wed Nov 10 02:51:36 2010 +0500 +++ b/core/componentmanager.lua Wed Nov 10 03:39:38 2010 +0500 @@ -40,7 +40,6 @@ for host, host_config in pairs(defined_hosts) do if host ~= "*" and ((host_config.core.enabled == nil or host_config.core.enabled) and type(host_config.core.component_module) == "string") then hosts[host] = create_component(host); - hosts[host].connected = false; components[host] = default_component_handler; local ok, err = modulemanager.load(host, host_config.core.component_module); if not ok then @@ -59,14 +58,14 @@ function create_component(host, component, events) -- TODO check for host well-formedness - return { type = "component", host = host, connected = true, s2sout = {}, + return { type = "component", host = host, s2sout = {}, events = events or events_new(), dialback_secret = configmanager.get(host, "core", "dialback_secret") or uuid_gen(), disallow_s2s = configmanager.get(host, "core", "disallow_s2s"); }; end function register_component(host, component) - if not hosts[host] or (hosts[host].type == 'component' and not hosts[host].connected) then + if not hosts[host] or hosts[host].type == 'component' then local old_events = hosts[host] and hosts[host].events; components[host] = component; @@ -98,7 +97,6 @@ if components[host] then modulemanager.unload(host, "tls"); modulemanager.unload(host, "dialback"); - hosts[host].connected = nil; local host_config = configmanager.getconfig()[host]; if host_config and ((host_config.core.enabled == nil or host_config.core.enabled) and type(host_config.core.component_module) == "string") then -- Set default handler
--- a/core/hostmanager.lua Wed Nov 10 02:51:36 2010 +0500 +++ b/core/hostmanager.lua Wed Nov 10 03:39:38 2010 +0500 @@ -49,7 +49,7 @@ prosody_events.add_handler("server-starting", load_enabled_hosts); function activate(host, host_config) - hosts[host] = {type = "local", connected = true, sessions = {}, + hosts[host] = {type = "local", sessions = {}, host = host, s2sout = {}, events = events_new(), disallow_s2s = configmanager.get(host, "core", "disallow_s2s") or (configmanager.get(host, "core", "anonymous_login")
--- a/core/modulemanager.lua Wed Nov 10 02:51:36 2010 +0500 +++ b/core/modulemanager.lua Wed Nov 10 03:39:38 2010 +0500 @@ -135,7 +135,6 @@ if not hosts[host] then local create_component = _G.require "core.componentmanager".create_component; hosts[host] = create_component(host); - hosts[host].connected = false; log("debug", "Created new component: %s", host); end hosts[host].modules = modulemap[host];
--- a/plugins/mod_component.lua Wed Nov 10 02:51:36 2010 +0500 +++ b/plugins/mod_component.lua Wed Nov 10 03:39:38 2010 +0500 @@ -29,7 +29,6 @@ main_session = nil; send = nil; session.on_destroy = nil; - hosts[session.host].connected = nil; end end @@ -98,7 +97,6 @@ send = session.send; main_session = session; session.on_destroy = on_destroy; - hosts[session.host].connected = true; log("info", "Component successfully registered"); else log("error", "Multiple components bound to the same address, first one wins (TODO: Implement stanza distribution)");