Changeset

777:f7a87acea220

Component-host module loading code was breaking module reload, andduplicated older code. Changed to reuse older code.
author Waqas Hussain <waqas20@gmail.com>
date Wed, 11 Feb 2009 17:56:42 +0500
parents 770:bddf52121908
children 778:0d94b4903cc7
files core/componentmanager.lua
diffstat 1 files changed, 2 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/core/componentmanager.lua	Wed Feb 04 18:53:56 2009 +0000
+++ b/core/componentmanager.lua	Wed Feb 11 17:56:42 2009 +0500
@@ -27,21 +27,13 @@
 		
 	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] = { type = "component", host = host, connected = true, s2sout = {} };
-			modulemanager.load(host, "dialback");
+			hosts[host] = { type = "component", host = host, connected = false, s2sout = {} };
 			local ok, err = modulemanager.load(host, host_config.core.component_module);
 			if not ok then
 				log("error", "Error loading %s component %s: %s", tostring(host_config.core.component_module), tostring(host), tostring(err));
 			else
 				log("info", "Activated %s component: %s", host_config.core.component_module, host);
 			end
-			
-			local ok, component_handler = modulemanager.call_module_method(modulemanager.get_module(host, host_config.core.component_module), "load_component");
-			if not ok then
-				log("error", "Error loading %s component %s: %s", tostring(host_config.core.component_module), tostring(host), tostring(component_handler));
-			else
-				components[host] = component_handler;
-			end
 		end
 	end
 end
@@ -63,7 +55,7 @@
 end
 
 function register_component(host, component)
-	if not hosts[host] then
+	if not hosts[host] or (hosts[host].type == 'component' and not hosts[host].connected) then
 		-- TODO check for host well-formedness
 		components[host] = component;
 		hosts[host] = { type = "component", host = host, connected = true, s2sout = {} };