mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
29 lines
588 B
Lua
29 lines
588 B
Lua
local skynet = require "skynet"
|
|
local debugchannel = require "debugchannel"
|
|
|
|
local CMD = {}
|
|
|
|
local channel
|
|
|
|
function CMD.start(address, fd)
|
|
assert(channel == nil, "start more than once")
|
|
skynet.error(string.format("Attach to :%08x", address))
|
|
local handle
|
|
channel, handle = debugchannel.create()
|
|
skynet.call(address, "debug", "REMOTEDEBUG", fd, handle)
|
|
-- todo hook
|
|
skynet.ret(skynet.pack(nil))
|
|
skynet.exit()
|
|
end
|
|
|
|
function CMD.cmd(cmdline)
|
|
channel:write(cmdline)
|
|
end
|
|
|
|
skynet.start(function()
|
|
skynet.dispatch("lua", function(_,_,cmd,...)
|
|
local f = CMD[cmd]
|
|
f(...)
|
|
end)
|
|
end)
|