You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/09/05 09:13:35 UTC

[GitHub] [apisix] tokers commented on a change in pull request #4980: fix(stream_route): replace ip match tools by using ipmatcher

tokers commented on a change in pull request #4980:
URL: https://github.com/apache/apisix/pull/4980#discussion_r702393439



##########
File path: apisix/stream/router/ip_port.lua
##########
@@ -33,14 +35,38 @@ local _M = {version = 0.1}
 
 local function match_addrs(route, vars)
     -- todo: use resty-ipmatcher to support multiple ip address
-    if route.value.remote_addr and
-       route.value.remote_addr ~= vars.remote_addr then
-        return false
+    if route.value.remote_addr then
+        local ip = remote_addr_match_cache[route.value.remote_addr]

Review comment:
       1. It's dangerous to use a module-level table to cache the match result, since it may cause the memory leak;
   2. The IP match overheads are not so high, the caching is unnecessary;




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org