Software / code / prosody-modules
Comparison
mod_firewall/mod_firewall.lua @ 2583:b6b10f57aa56
mod_firewall: Fix for including the same dependency with different parameters
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sun, 26 Feb 2017 09:49:42 +0000 |
| parent | 2580:aaff2716f022 |
| child | 2584:d64fc9c3cffd |
comparison
equal
deleted
inserted
replaced
| 2582:ac3140cd89a2 | 2583:b6b10f57aa56 |
|---|---|
| 258 local dep_info = available_deps[dep]; | 258 local dep_info = available_deps[dep]; |
| 259 if not dep_info then | 259 if not dep_info then |
| 260 module:log("error", "Dependency not found: %s", dep); | 260 module:log("error", "Dependency not found: %s", dep); |
| 261 return; | 261 return; |
| 262 end | 262 end |
| 263 if code.included_deps[dep] ~= nil then | 263 if code.included_deps[dependency] ~= nil then |
| 264 if code.included_deps[dep] ~= true then | 264 if code.included_deps[dependency] ~= true then |
| 265 module:log("error", "Circular dependency on %s", dep); | 265 module:log("error", "Circular dependency on %s", dep); |
| 266 end | 266 end |
| 267 return; | 267 return; |
| 268 end | 268 end |
| 269 code.included_deps[dep] = false; -- Pending flag (used to detect circular references) | 269 code.included_deps[dependency] = false; -- Pending flag (used to detect circular references) |
| 270 for _, dep_dep in ipairs(dep_info.depends or {}) do | 270 for _, dep_dep in ipairs(dep_info.depends or {}) do |
| 271 include_dep(dep_dep, code); | 271 include_dep(dep_dep, code); |
| 272 end | 272 end |
| 273 if dep_info.global_code then | 273 if dep_info.global_code then |
| 274 if dep_param ~= "" then | 274 if dep_param ~= "" then |
| 294 table.insert(code, "\n\t\t-- "..dep.."\n\t\t"..local_code.."\n"); | 294 table.insert(code, "\n\t\t-- "..dep.."\n\t\t"..local_code.."\n"); |
| 295 else | 295 else |
| 296 table.insert(code, "\n\t\t-- "..dep.."\n\t\t"..dep_info.local_code.."\n"); | 296 table.insert(code, "\n\t\t-- "..dep.."\n\t\t"..dep_info.local_code.."\n"); |
| 297 end | 297 end |
| 298 end | 298 end |
| 299 code.included_deps[dep] = true; | 299 code.included_deps[dependency] = true; |
| 300 end | 300 end |
| 301 | 301 |
| 302 local definition_handlers = module:require("definitions"); | 302 local definition_handlers = module:require("definitions"); |
| 303 local condition_handlers = module:require("conditions"); | 303 local condition_handlers = module:require("conditions"); |
| 304 local action_handlers = module:require("actions"); | 304 local action_handlers = module:require("actions"); |