tzssangglass commented on code in PR #8219:
URL: https://github.com/apache/apisix/pull/8219#discussion_r1021540158


##########
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:
   Let's keep it simple and clear enough in this PR. 



-- 
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]

Reply via email to