mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-01 00:19:33 +00:00
Fix get_assigned_id lookup
This commit is contained in:
parent
9d57d9ffce
commit
1926a1c247
1 changed files with 10 additions and 1 deletions
|
|
@ -35,7 +35,8 @@ end
|
|||
-- ##############################################
|
||||
|
||||
local function assigned_id_key(const_type, const_key)
|
||||
return string.format("ntopng.prefs.plugins_consts_utils.assigned_ids.const_type_%s.const_key_%s", const_type, const_key)
|
||||
local hname = assigned_ids_hname(const_type)
|
||||
return string.format("%s.const_key_%s", hname, const_key)
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
|
@ -200,6 +201,14 @@ function plugins_consts_utils.get_assigned_id(const_type, const_key)
|
|||
local kname = assigned_id_key(const_type, const_key)
|
||||
local assigned_id = tonumber(ntop.getPref(kname))
|
||||
|
||||
if assigned_id == nil then
|
||||
-- Not found in the internal cache, check the hash
|
||||
local cur_id_to_key, cur_key_to_id = get_assigned_ids(const_type)
|
||||
if cur_key_to_id[const_key] ~= nil then
|
||||
return cur_key_to_id[const_key]
|
||||
end
|
||||
end
|
||||
|
||||
-- Make sure the index is within the configured bounds
|
||||
if assigned_id then
|
||||
if assigned_id < AVAILABLE_CONSTS[const_type]["min_id"] or assigned_id > AVAILABLE_CONSTS[const_type]["max_id"] then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue