Skip to content

Commit

Permalink
perf(pdk) optimize kong.ip module by tracking a table size via a local
Browse files Browse the repository at this point in the history
From #4169
  • Loading branch information
moonming authored and thibaultcha committed Jan 8, 2019
1 parent 488ee21 commit 250757c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kong/pdk/ip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ local function new(self)
-- supports. Also as an optimization we will only compile trusted ips if
-- Kong is not run with the default 0.0.0.0/0, ::/0 aka trust all ip
-- addresses settings.
local idx = 1
for i = 1, n_ips do
local address = ips[i]

if ip.valid(address) then
table.insert(trusted_ips, address)
trusted_ips[idx] = address
idx = idx + 1

if address == "0.0.0.0/0" then
trust_all_ipv4 = true
Expand Down

0 comments on commit 250757c

Please sign in to comment.