Skip to content

Commit

Permalink
payload_method
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw committed Dec 23, 2024
1 parent 9ee3539 commit 19e9278
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions kong/clustering/rpc/socket.lua
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,14 @@ function _M:process_rpc_msg(payload, results)
assert(payload.jsonrpc == jsonrpc.VERSION)

local payload_id = payload.id
local payload_method = payload.method

if payload.method then
if payload_method then
-- invoke

ngx_log(ngx_DEBUG, "[rpc] got RPC call: ", payload.method, " (id: ", payload_id, ")")
ngx_log(ngx_DEBUG, "[rpc] got RPC call: ", payload_method, " (id: ", payload_id, ")")

local dispatch_cb = self.manager.callbacks.callbacks[payload.method]
local dispatch_cb = self.manager.callbacks.callbacks[payload_method]
if not dispatch_cb and payload_id then
local res, err = self:push_result(new_error(payload_id, jsonrpc.METHOD_NOT_FOUND),
"unable to send \"METHOD_NOT_FOUND\" error back to client: ",
Expand All @@ -148,7 +149,7 @@ function _M:process_rpc_msg(payload, results)

-- call dispatch
local res, err = kong.timer:named_at(string_format("JSON-RPC callback for node_id: %s, id: %d, method: %s",
self.node_id, payload_id or 0, payload.method),
self.node_id, payload_id or 0, payload_method),
0, _M._dispatch, self, dispatch_cb, payload, results)
if not res and payload_id then
local reso, erro = self:push_result(new_error(payload_id, jsonrpc.INTERNAL_ERROR),
Expand Down

0 comments on commit 19e9278

Please sign in to comment.