Commit 9f20f1f7 authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

Limit: default value for count

parent a4b108a3
......@@ -201,10 +201,10 @@ members of a top-level dictionary but are embedded into other objects.
In its simplest form, a limit definition is an integer specifying the
maximum number of packets or connections per second. More complex
limits are defined as objects, where the **count** attribute define
limits are defined as objects, where the **count** attribute defines
the maximum during an interval defined by the **interval**
attribute. The unit of the **interval** attribute is second, and the
default value is 1.
default value is 1. The default value for **count** is 1 as well.
The maximum rate defined by a limit may be absolute or specific to
blocks of IP addresses or pairs thereof. The number of most
......@@ -784,13 +784,7 @@ end
M.Limit = M.class(M.Maskable)
function M.Limit:init(...)
if not self.count then
if not self[1] then
self:error('Packet count not defined for limit')
self.count = self[1]
setdefault(self, 'count', self[1] or 1)
setdefault(self, 'interval', 1)
......@@ -27,8 +27,8 @@ function add(limit_type, filter)
local count = high_rate and 150 or 1
local count = high_rate and 150 or nil
add_limit(count or 1)
for _, interval in ipairs{false, 5} do
for _, log in ipairs{true, false, 'none'} do
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment