mirror of
https://github.com/foxcpp/maddy.git
synced 2025-04-06 06:27:38 +03:00
limits: Fix "rate" directive parser handling for 2 arguments
This commit is contained in:
parent
a0606bd4fc
commit
b38ae23fca
1 changed files with 3 additions and 0 deletions
|
@ -122,6 +122,7 @@ func rateCtor(node config.Node, args []string) (func() limiters.L, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, config.NodeErr(node, "%v", err)
|
return nil, config.NodeErr(node, "%v", err)
|
||||||
}
|
}
|
||||||
|
fallthrough
|
||||||
case 1:
|
case 1:
|
||||||
var err error
|
var err error
|
||||||
burst, err = strconv.Atoi(args[0])
|
burst, err = strconv.Atoi(args[0])
|
||||||
|
@ -130,6 +131,8 @@ func rateCtor(node config.Node, args []string) (func() limiters.L, error) {
|
||||||
}
|
}
|
||||||
case 0:
|
case 0:
|
||||||
return nil, config.NodeErr(node, "at least burst size is needed")
|
return nil, config.NodeErr(node, "at least burst size is needed")
|
||||||
|
default:
|
||||||
|
return nil, config.NodeErr(node, "too many arguments")
|
||||||
}
|
}
|
||||||
|
|
||||||
return func() limiters.L {
|
return func() limiters.L {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue