linking: handle defined target properly with smart filters
This patch fixes the policy to not link the client to the default filter if the client's defined target is found, is not a filter, does not have any other filters linked with it. In this case, the client is therefore linked to the actual defined target. On the other hand, if the client's defined target is a filter, the client is linked to the first filter in the chain that has the same target as the defined filter's target.
This commit is contained in:
@@ -102,6 +102,7 @@ SimpleEventHook {
|
||||
end
|
||||
end
|
||||
|
||||
si_flags.has_defined_target = false
|
||||
if target_picked and target then
|
||||
log:info (si,
|
||||
string.format ("... defined target picked: %s (%s), can_passthrough:%s",
|
||||
@@ -110,6 +111,7 @@ SimpleEventHook {
|
||||
tostring (can_passthrough)))
|
||||
si_flags.has_node_defined_target = node_defined
|
||||
si_flags.can_passthrough = can_passthrough
|
||||
si_flags.has_defined_target = true
|
||||
event:set_data ("target", target)
|
||||
elseif target_value and dont_fallback then
|
||||
-- send error to client and destroy node if linger is not set
|
||||
|
@@ -35,11 +35,17 @@ SimpleEventHook {
|
||||
return
|
||||
end
|
||||
|
||||
-- Get the filter from the given target, if any
|
||||
-- Get the filter from the given target if it exists, otherwise get the
|
||||
-- default filter, but only if target was not defined
|
||||
local target_direction = cutils.getTargetDirection (si.properties)
|
||||
local filter_target = futils.get_filter_from_target (target_direction, target)
|
||||
if filter_target ~= nil then
|
||||
target = filter_target
|
||||
elseif filter_target == nil and not si_flags.has_defined_target then
|
||||
filter_target = futils.get_filter_from_target (target_direction, nil)
|
||||
if filter_target ~= nil then
|
||||
target = filter_target
|
||||
end
|
||||
end
|
||||
|
||||
local can_passthrough, passthrough_compatible
|
||||
|
Reference in New Issue
Block a user