mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
improve unregister protocol error report
This commit is contained in:
@@ -415,9 +415,13 @@ function skynet.wakeup(co)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function skynet.dispatch(typename, func)
|
function skynet.dispatch(typename, func)
|
||||||
local p = assert(proto[typename],tostring(typename))
|
local p = proto[typename]
|
||||||
assert(p.dispatch == nil, tostring(typename))
|
if func then
|
||||||
|
assert(p and (p.dispatch == nil), tostring(typename))
|
||||||
p.dispatch = func
|
p.dispatch = func
|
||||||
|
else
|
||||||
|
return p and p.dispatch
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function unknown_request(session, address, msg, sz, prototype)
|
local function unknown_request(session, address, msg, sz, prototype)
|
||||||
@@ -466,7 +470,15 @@ local function raw_dispatch_message(prototype, msg, sz, session, source, ...)
|
|||||||
suspend(co, coroutine.resume(co, true, msg, sz))
|
suspend(co, coroutine.resume(co, true, msg, sz))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local p = assert(proto[prototype], prototype)
|
local p = proto[prototype]
|
||||||
|
if p == nil then
|
||||||
|
if session ~= 0 then
|
||||||
|
c.send(source, skynet.PTYPE_ERROR, session, "")
|
||||||
|
else
|
||||||
|
unknown_request(session, source, msg, sz, prototype)
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
local f = p.dispatch
|
local f = p.dispatch
|
||||||
if f then
|
if f then
|
||||||
local ref = watching_service[source]
|
local ref = watching_service[source]
|
||||||
|
|||||||
@@ -63,6 +63,10 @@ function dbgcmd.REMOTEDEBUG(...)
|
|||||||
remotedebug.start(export, ...)
|
remotedebug.start(export, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function dbgcmd.SUPPORT(pname)
|
||||||
|
return skynet.ret(skynet.pack(skynet.dispatch(pname) ~= nil))
|
||||||
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user