Software / code / prosody
Comparison
core/modulemanager.lua @ 4643:9008fc396fb1
modulemanager: When a shared module becomes global, ensure it still gets loaded onto the original target host
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sat, 21 Apr 2012 20:37:06 +0100 |
| parent | 4642:c1602c07d14d |
| child | 4652:9d24bc503621 |
comparison
equal
deleted
inserted
replaced
| 4642:c1602c07d14d | 4643:9008fc396fb1 |
|---|---|
| 181 if api_instance.host == "*" then | 181 if api_instance.host == "*" then |
| 182 if not api_instance.global then -- COMPAT w/pre-0.9 | 182 if not api_instance.global then -- COMPAT w/pre-0.9 |
| 183 log("warn", "mod_%s: Setting module.host = '*' deprecated, call module:set_global() instead", module_name); | 183 log("warn", "mod_%s: Setting module.host = '*' deprecated, call module:set_global() instead", module_name); |
| 184 api_instance:set_global(); | 184 api_instance:set_global(); |
| 185 end | 185 end |
| 186 else | 186 if host ~= api_instance.host and module_has_method(pluginenv, "add_host") then |
| 187 modulemap[host][module_name] = pluginenv; | 187 -- Now load the module again onto the host it was originally being loaded on |
| 188 do_load_module(host, module_name); | |
| 189 end | |
| 188 end | 190 end |
| 189 end | 191 end |
| 190 if not ok then | 192 if not ok then |
| 191 log("error", "Error initializing module '%s' on '%s': %s", module_name, host, err or "nil"); | 193 log("error", "Error initializing module '%s' on '%s': %s", module_name, host, err or "nil"); |
| 192 end | 194 end |