skynet.service: add close (#1526)

Co-authored-by: drew.zxj <drew.zxj@alibaba-inc.com>
This commit is contained in:
xjdrew
2022-01-21 10:34:00 +08:00
committed by GitHub
parent 923651ada3
commit 6d6be8dec6
2 changed files with 20 additions and 0 deletions

View File

@@ -91,6 +91,16 @@ function provider.test(name)
end
end
function provider.close(name)
local s = svr[name]
if not s or s.booting then
return skynet.ret(skynet.pack(nil))
end
svr[name] = nil
skynet.ret(skynet.pack(s.address))
end
skynet.start(function()
skynet.dispatch("lua", function(session, address, cmd, ...)
provider[cmd](...)