call skynet.trace() in example

This commit is contained in:
Cloud Wu
2018-05-26 17:37:19 +08:00
parent 596c77afcd
commit d6f265e703
2 changed files with 7 additions and 1 deletions

View File

@@ -50,7 +50,10 @@ skynet.register_protocol {
unpack = function (msg, sz)
return host:dispatch(msg, sz)
end,
dispatch = function (_, _, type, ...)
dispatch = function (fd, _, type, ...)
assert(fd == client_fd) -- You can use fd to reply message
skynet.ignoreret() -- session is fd, don't call skynet.ret
skynet.trace()
if type == "REQUEST" then
local ok, result = pcall(request, ...)
if ok then
@@ -92,6 +95,7 @@ end
skynet.start(function()
skynet.dispatch("lua", function(_,_, command, ...)
skynet.trace()
local f = CMD[command]
skynet.ret(skynet.pack(f(...)))
end)

View File

@@ -265,6 +265,8 @@ function suspend(co, result, command, param, param2)
return suspend(co, coroutine_resume(co, response))
elseif command == "EXIT" then
-- coroutine exit
local tag = session_coroutine_tracetag[co]
if tag then c.trace(tag, "end") end
local address = session_coroutine_address[co]
if address then
release_watching(address)