Skip to content

Commit

Permalink
perf(core) pass ngx.ctx to mesh runloop
Browse files Browse the repository at this point in the history
  • Loading branch information
bungle committed Dec 10, 2018
1 parent 91731d4 commit 40a073e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion kong/runloop/handler.lua
Expand Up @@ -621,7 +621,7 @@ return {
ctx.KONG_REWRITE_START = get_now()
mesh.rewrite()
end,
after = function (ctx)
after = function(ctx)
ctx.KONG_REWRITE_TIME = get_now() - ctx.KONG_REWRITE_START -- time spent in Kong's rewrite_by_lua
end
},
Expand Down
6 changes: 3 additions & 3 deletions kong/runloop/mesh.lua
Expand Up @@ -192,16 +192,16 @@ local function certificate()
end


local function rewrite()
local function rewrite(ctx)
local ssl = getssl()
if ssl and ssl:getAlpnSelected() == mesh_alpn then
if ngx.ctx.is_service_mesh_request then
if ctx.is_service_mesh_request then
ngx.log(ngx.ERR, "already service mesh; circular routing?")
return ngx.exit(500)
end

-- Assume OpenSSL verification worked
ngx.ctx.is_service_mesh_request = true
ctx.is_service_mesh_request = true

-- Fixup Host
-- Unless the route had preserve_host set then the host on the request has
Expand Down

0 comments on commit 40a073e

Please sign in to comment.