mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 03:53:09 +00:00
skynet.kill would raise error
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user