biakecw commented on code in PR #8219:
URL: https://github.com/apache/apisix/pull/8219#discussion_r1021034262
##########
apisix/stream/router/ip_port.lua:
##########
@@ -63,23 +63,46 @@ local create_router
do
local sni_to_items = {}
local tls_routes = {}
+ local routeid_to_protocols = {}
function create_router(items)
local tls_routes_idx = 1
local other_routes_idx = 1
core.table.clear(tls_routes)
core.table.clear(other_routes)
core.table.clear(sni_to_items)
+ core.table.clear(routeid_to_protocols)
for _, item in config_util.iterate_values(items) do
if item.value == nil then
goto CONTINUE
end
+ local route = item.value
+ if route.protocol then
+ routeid_to_protocols[item.key]=route.protocol.name
+ else
+ routeid_to_protocols[item.key]="No-Protocol"
+ end
+ ::CONTINUE::
+ end
+ for _, item in config_util.iterate_values(items) do
+ if item.value == nil then
+ goto CONTINUE
+ end
local route = item.value
if route.protocol and route.protocol.superior_id then
-- subordinate route won't be matched in the entry
- -- TODO: check the subordinate relationship in the Admin API
+ local key="/apisix/stream_routes/"..route.protocol.superior_id
+ if routeid_to_protocols[key] == nil then
+ core.log.warn("There is not exist stream_route: "..key)
+ elseif routeid_to_protocols[key] == "No-Protocol" then
+ core.log.warn("The stream_route: "..key.." may lacks
procotol configuration")
+ elseif routeid_to_protocols[key] == route.protocol.name then
+ goto CONTINUE
+ else
+ core.log.warn("Different between
stream_route:"..item.key.." and "..key)
+ end
goto CONTINUE
Review Comment:
Yes, no action here, just warn logging。In order to remind users, do you
think it's ok to keep this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]