Avoid flow.lua overhead if all the modules are disabled

This commit is contained in:
emanuele-f 2019-09-11 14:52:26 +02:00
parent e31afe72d6
commit e4f1d1f5d3
4 changed files with 45 additions and 8 deletions

View file

@ -465,7 +465,20 @@ function mud_utils.getHostMUDRecordingPref(ifid, host_key)
end
function mud_utils.setHostMUDRecordingPref(ifid, host_key, val)
ntop.setPref(getHostMUDRecordingKey(ifid, host_key), val)
local key = getHostMUDRecordingKey(ifid, host_key)
if(val == "disabled") then
ntop.delCache(key)
else
ntop.setPref(key, val)
end
end
-- ###########################################
function mud_utils.isMUDRecordingEnabled(ifid)
local pattern = getHostMUDRecordingKey(ifid, "*")
return(table.len(ntop.getKeysCache(pattern)) > 0)
end
-- ###########################################