mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 03:53:09 +00:00
bugfix: error in forked coroutine. and add skynet.term()
This commit is contained in:
@@ -143,13 +143,15 @@ end
|
||||
function suspend(co, result, command, param, size)
|
||||
if not result then
|
||||
local session = session_coroutine_id[co]
|
||||
local addr = session_coroutine_address[co]
|
||||
if session ~= 0 then
|
||||
-- only call response error
|
||||
c.send(addr, skynet.PTYPE_ERROR, session, "")
|
||||
if session then -- coroutine may fork by others (session is nil)
|
||||
local addr = session_coroutine_address[co]
|
||||
if session ~= 0 then
|
||||
-- only call response error
|
||||
c.send(addr, skynet.PTYPE_ERROR, session, "")
|
||||
end
|
||||
session_coroutine_id[co] = nil
|
||||
session_coroutine_address[co] = nil
|
||||
end
|
||||
session_coroutine_id[co] = nil
|
||||
session_coroutine_address[co] = nil
|
||||
error(debug.traceback(co,tostring(command)))
|
||||
end
|
||||
if command == "CALL" then
|
||||
@@ -696,6 +698,10 @@ function skynet.task(ret)
|
||||
return t
|
||||
end
|
||||
|
||||
function skynet.term(service)
|
||||
return _error_dispatch(0, service)
|
||||
end
|
||||
|
||||
-- Inject internal debug framework
|
||||
local debug = require "skynet.debug"
|
||||
debug(skynet, dispatch_message)
|
||||
|
||||
@@ -54,6 +54,10 @@ function dbgcmd.RUN(source, filename)
|
||||
skynet.ret(skynet.pack(table.concat(output, "\n")))
|
||||
end
|
||||
|
||||
function dbgcmd.TERM(service)
|
||||
skynet.term(service)
|
||||
end
|
||||
|
||||
local function _debug_dispatch(session, address, cmd, ...)
|
||||
local f = dbgcmd[cmd]
|
||||
assert(f, cmd)
|
||||
|
||||
Reference in New Issue
Block a user