mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
support user tag
This commit is contained in:
@@ -11,7 +11,7 @@ skynet.start(function()
|
|||||||
skynet.send(proxy, "lua", "PING", "proxy")
|
skynet.send(proxy, "lua", "PING", "proxy")
|
||||||
|
|
||||||
skynet.fork(function()
|
skynet.fork(function()
|
||||||
skynet.trace()
|
skynet.trace("cluster")
|
||||||
print(cluster.call("db", "@sdb", "GET", "a"))
|
print(cluster.call("db", "@sdb", "GET", "a"))
|
||||||
print(cluster.call("db2", "@sdb", "GET", "b"))
|
print(cluster.call("db2", "@sdb", "GET", "b"))
|
||||||
cluster.send("db2", "@sdb", "PING", "db2:longstring" .. largevalue)
|
cluster.send("db2", "@sdb", "PING", "db2:longstring" .. largevalue)
|
||||||
|
|||||||
@@ -289,7 +289,11 @@ function suspend(co, result, command, param, param2)
|
|||||||
elseif command == "TRACE" then
|
elseif command == "TRACE" then
|
||||||
if param then
|
if param then
|
||||||
session_coroutine_tracetag[co] = param
|
session_coroutine_tracetag[co] = param
|
||||||
c.trace(param, "trace on")
|
if param2 then
|
||||||
|
c.trace(param, "trace " .. param2)
|
||||||
|
else
|
||||||
|
c.trace(param, "trace")
|
||||||
|
end
|
||||||
else
|
else
|
||||||
param = session_coroutine_tracetag[co]
|
param = session_coroutine_tracetag[co]
|
||||||
end
|
end
|
||||||
@@ -352,9 +356,9 @@ skynet.now = c.now
|
|||||||
skynet.hpc = c.hpc -- high performance counter
|
skynet.hpc = c.hpc -- high performance counter
|
||||||
|
|
||||||
local traceid = 0
|
local traceid = 0
|
||||||
function skynet.trace()
|
function skynet.trace(info)
|
||||||
traceid = traceid + 1
|
traceid = traceid + 1
|
||||||
coroutine_yield("TRACE", string.format(":%08x-%d",skynet.self(), traceid))
|
coroutine_yield("TRACE", string.format(":%08x-%d",skynet.self(), traceid), info)
|
||||||
end
|
end
|
||||||
|
|
||||||
function skynet.tracetag()
|
function skynet.tracetag()
|
||||||
@@ -459,12 +463,12 @@ function skynet.rawcall(addr, typename, msg, sz)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function skynet.tracecall(tag, addr, typename, msg, sz)
|
function skynet.tracecall(tag, addr, typename, msg, sz)
|
||||||
c.trace(tag, "trace begin")
|
c.trace(tag, "tracecall begin")
|
||||||
c.send(addr, skynet.PTYPE_TRACE, 0, tag)
|
c.send(addr, skynet.PTYPE_TRACE, 0, tag)
|
||||||
local p = proto[typename]
|
local p = proto[typename]
|
||||||
local session = assert(c.send(addr, p.id , nil , msg, sz), "call to invalid address")
|
local session = assert(c.send(addr, p.id , nil , msg, sz), "call to invalid address")
|
||||||
local msg, sz = yield_call(addr, session)
|
local msg, sz = yield_call(addr, session)
|
||||||
c.trace(tag, "trace end")
|
c.trace(tag, "tracecall end")
|
||||||
return msg, sz
|
return msg, sz
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user