Mercurial > prosody-modules
comparison mod_firewall/definitions.lib.lua @ 2536:22a271641c29
mod_firewall: Improve debug logging for LIST file backend
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 20 Feb 2017 13:13:54 +0000 |
parents | b85d88737a32 |
children | d28e434cb5fd |
comparison
equal
deleted
inserted
replaced
2535:b85d88737a32 | 2536:22a271641c29 |
---|---|
146 if not file then | 146 if not file then |
147 module:log("warn", "Failed to open list from %s: %s", filename, err); | 147 module:log("warn", "Failed to open list from %s: %s", filename, err); |
148 return; | 148 return; |
149 end | 149 end |
150 local items = {}; | 150 local items = {}; |
151 local n = 0; | |
151 for line in file:lines() do | 152 for line in file:lines() do |
152 items[line] = true; | 153 if not items[line] then |
154 n = n + 1; | |
155 items[line] = true; | |
156 end | |
153 end | 157 end |
154 self.items = items; | 158 self.items = items; |
159 module:log("debug", "Loaded %d items from %s", n, filename); | |
155 end; | 160 end; |
156 add = function (self, item) | 161 add = function (self, item) |
157 self.items[item] = true; | 162 self.items[item] = true; |
158 end; | 163 end; |
159 remove = function (self, item) | 164 remove = function (self, item) |