From 72c2fad82a723e0022d8f013d20c943168e32907 Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Thu, 5 Feb 2015 18:25:06 +0800 Subject: [PATCH] skynet.kill would raise error --- lualib/skynet.lua | 4 ++-- service/launcher.lua | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lualib/skynet.lua b/lualib/skynet.lua index 63857259..d34a7f45 100644 --- a/lualib/skynet.lua +++ b/lualib/skynet.lua @@ -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) diff --git a/service/launcher.lua b/service/launcher.lua index f4ac16fe..28192754 100644 --- a/service/launcher.lua +++ b/service/launcher.lua @@ -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