mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
debug info
This commit is contained in:
@@ -394,6 +394,12 @@ end
|
|||||||
|
|
||||||
----- debug
|
----- debug
|
||||||
|
|
||||||
|
local internal_info_func
|
||||||
|
|
||||||
|
function skynet.info_func(func)
|
||||||
|
internal_info_func = func
|
||||||
|
end
|
||||||
|
|
||||||
local dbgcmd = {}
|
local dbgcmd = {}
|
||||||
|
|
||||||
function dbgcmd.MEM()
|
function dbgcmd.MEM()
|
||||||
@@ -416,6 +422,14 @@ function dbgcmd.STAT()
|
|||||||
skynet.ret(skynet.pack(stat))
|
skynet.ret(skynet.pack(stat))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function dbgcmd.INFO()
|
||||||
|
if internal_info_func then
|
||||||
|
skynet.ret(skynet.pack(internal_info_func()))
|
||||||
|
else
|
||||||
|
skynet.ret(skynet.pack(nil))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function _debug_dispatch(session, address, cmd, ...)
|
local function _debug_dispatch(session, address, cmd, ...)
|
||||||
local f = dbgcmd[cmd]
|
local f = dbgcmd[cmd]
|
||||||
assert(f, cmd)
|
assert(f, cmd)
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
local skynet = require "skynet"
|
local skynet = require "skynet"
|
||||||
|
local print_r = require "print_r"
|
||||||
|
|
||||||
local cmd = { ... }
|
local cmd = { ... }
|
||||||
|
|
||||||
skynet.start(function()
|
skynet.start(function()
|
||||||
local list = skynet.call(".launcher","lua", unpack(cmd))
|
local list = skynet.call(".launcher","lua", unpack(cmd))
|
||||||
for k,v in pairs(list) do
|
if list then
|
||||||
print(k,v)
|
print_r(list)
|
||||||
end
|
end
|
||||||
skynet.exit()
|
skynet.exit()
|
||||||
end)
|
end)
|
||||||
@@ -26,6 +26,15 @@ function command.STAT()
|
|||||||
skynet.ret(skynet.pack(list))
|
skynet.ret(skynet.pack(list))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function command.INFO(handle)
|
||||||
|
if services[handle] == nil then
|
||||||
|
skynet.ret(skynet.pack(nil))
|
||||||
|
else
|
||||||
|
local result = skynet.call(handle,"debug","INFO")
|
||||||
|
skynet.ret(skynet.pack(result))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function command.KILL(handle)
|
function command.KILL(handle)
|
||||||
skynet.kill(handle)
|
skynet.kill(handle)
|
||||||
skynet.ret( skynet.pack({ [handle] = tostring(services[handle]) }))
|
skynet.ret( skynet.pack({ [handle] = tostring(services[handle]) }))
|
||||||
|
|||||||
Reference in New Issue
Block a user