optimize global unique service query

This commit is contained in:
Cloud Wu
2014-04-19 16:47:52 +08:00
parent c577a4f07d
commit 2d56a2215a
2 changed files with 70 additions and 45 deletions

View File

@@ -410,26 +410,12 @@ function skynet.newservice(name, ...)
end
end
function skynet.uniqueservice(global, ...)
local handle
if global == true then
handle = skynet.call("SERVICE", "lua", "LAUNCH", ...)
else
handle = skynet.call(".service", "lua", "LAUNCH", global, ...)
end
assert(handle , "Unique service launch failed")
return handle
function skynet.uniqueservice(...)
return assert(skynet.call(".service", "lua", "LAUNCH", ...))
end
function skynet.queryservice(global, ...)
local handle
if global == true then
handle = skynet.call("SERVICE", "lua", "QUERY", ...)
else
handle = skynet.call(".service", "lua", "QUERY", global, ...)
end
assert(handle , "Unique service query failed")
return handle
function skynet.queryservice(global, name)
return assert(skynet.call(".service", "lua", "QUERY", global, name))
end
local function group_command(cmd, handle, address)