mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
call skynet.trace() in example
This commit is contained in:
@@ -50,7 +50,10 @@ skynet.register_protocol {
|
|||||||
unpack = function (msg, sz)
|
unpack = function (msg, sz)
|
||||||
return host:dispatch(msg, sz)
|
return host:dispatch(msg, sz)
|
||||||
end,
|
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
|
if type == "REQUEST" then
|
||||||
local ok, result = pcall(request, ...)
|
local ok, result = pcall(request, ...)
|
||||||
if ok then
|
if ok then
|
||||||
@@ -92,6 +95,7 @@ end
|
|||||||
|
|
||||||
skynet.start(function()
|
skynet.start(function()
|
||||||
skynet.dispatch("lua", function(_,_, command, ...)
|
skynet.dispatch("lua", function(_,_, command, ...)
|
||||||
|
skynet.trace()
|
||||||
local f = CMD[command]
|
local f = CMD[command]
|
||||||
skynet.ret(skynet.pack(f(...)))
|
skynet.ret(skynet.pack(f(...)))
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -265,6 +265,8 @@ function suspend(co, result, command, param, param2)
|
|||||||
return suspend(co, coroutine_resume(co, response))
|
return suspend(co, coroutine_resume(co, response))
|
||||||
elseif command == "EXIT" then
|
elseif command == "EXIT" then
|
||||||
-- coroutine exit
|
-- coroutine exit
|
||||||
|
local tag = session_coroutine_tracetag[co]
|
||||||
|
if tag then c.trace(tag, "end") end
|
||||||
local address = session_coroutine_address[co]
|
local address = session_coroutine_address[co]
|
||||||
if address then
|
if address then
|
||||||
release_watching(address)
|
release_watching(address)
|
||||||
|
|||||||
Reference in New Issue
Block a user