Skip to content

Commit

Permalink
clusterd support send
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwu committed Dec 2, 2016
1 parent d0a41eb commit ace41d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lualib/cluster.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ function cluster.call(node, address, ...)
return skynet.call(clusterd, "lua", "req", node, address, skynet.pack(...))
end

function cluster.send(node, address, ...)
-- skynet.pack(...) will free by cluster.core.packrequest
skynet.send(clusterd, "lua", "req", node, address, skynet.pack(...))
end

function cluster.open(port)
if type(port) == "string" then
skynet.call(clusterd, "lua", "listen", port)
Expand Down
3 changes: 3 additions & 0 deletions lualib/skynet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ function suspend(co, result, command, param, size)
sleep_session[co] = param
elseif command == "RETURN" then
local co_session = session_coroutine_id[co]
if co_session == 0 then
return suspend(co, coroutine_resume(co, false)) -- send don't need ret
end
local co_address = session_coroutine_address[co]
if param == nil or session_response[co] then
error(debug.traceback(co))
Expand Down

0 comments on commit ace41d7

Please sign in to comment.