skynet.kill would raise error

This commit is contained in:
Cloud Wu
2015-02-05 18:25:06 +08:00
parent 7c7d63ea70
commit 72c2fad82a
2 changed files with 4 additions and 4 deletions

View File

@@ -339,7 +339,7 @@ end
function skynet.exit()
fork_queue = {} -- no fork coroutine can be execute after skynet.exit
skynet.send(".launcher","lua","REMOVE",skynet.self())
skynet.send(".launcher","lua","REMOVE",skynet.self(), false)
-- report the sources that call me
for co, session in pairs(session_coroutine_id) do
local address = session_coroutine_address[co]
@@ -362,7 +362,7 @@ end
function skynet.kill(name)
if type(name) == "number" then
skynet.send(".launcher","lua","REMOVE",name)
skynet.send(".launcher","lua","REMOVE",name, true)
name = skynet.address(name)
end
c.command("KILL",name)

View File

@@ -53,12 +53,12 @@ function command.GC()
return command.MEM()
end
function command.REMOVE(_, handle)
function command.REMOVE(_, handle, kill)
services[handle] = nil
local response = instance[handle]
if response then
-- instance is dead
response(true) -- return nil to caller of newservice
response(not kill) -- return nil to caller of newservice, when kill == false
instance[handle] = nil
end