sessionmanager, s2smanager: Give sessions dummy data handlers that log when data...
[prosody.git] / core / componentmanager.lua
index 2d292c8fbe76d20d8a4659267fcb38d5c687534e..a16c01d2934a768008690b3364d6686d7b3cf7b8 100644 (file)
@@ -26,7 +26,7 @@ local NULL = {};
 module "componentmanager"
 
 local function default_component_handler(origin, stanza)
-       log("warn", "Stanza being handled by default component, bouncing error");
+       log("warn", "Stanza being handled by default component; bouncing error for: %s", stanza:top_tag());
        if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then
                origin.send(st.error_reply(stanza, "wait", "service-unavailable", "Component unavailable"));
        end
@@ -67,6 +67,7 @@ function handle_stanza(origin, stanza)
                component(origin, stanza, hosts[host]);
        else
                log("error", "Component manager recieved a stanza for a non-existing component: "..tostring(stanza));
+               default_component_handler(origin, stanza);
        end
 end
 
@@ -113,6 +114,7 @@ end
 
 function deregister_component(host)
        if components[host] then
+               modulemanager.unload(host, "tls");
                modulemanager.unload(host, "dialback");
                hosts[host].connected = nil;
                local host_config = configmanager.getconfig()[host];
@@ -121,7 +123,7 @@ function deregister_component(host)
                        components[host] = default_component_handler;
                else
                        -- Component not in config, or disabled, remove
-                       hosts[host] = nil;
+                       hosts[host] = nil; -- FIXME do proper unload of all modules and other cleanup before removing
                        components[host] = nil;
                end
                -- remove from disco_items