1 -- mod_c2s_limit_sessions
3 local next, count
= next, require
"util.iterators".count
;
5 local max_resources
= module
:get_option_number("max_resources", 10);
7 local sessions
= hosts
[module
.host
].sessions
;
8 module
:hook("resource-bind", function(event
)
9 local session
= event
.session
;
10 if count(next, sessions
[session
.username
].sessions
) > max_resources
then
11 session
:close
{ condition
= "policy-violation", text
= "Too many resources" };