diff --git a/lualib/skynet.lua b/lualib/skynet.lua index 5b5762c3..19d28b56 100644 --- a/lualib/skynet.lua +++ b/lualib/skynet.lua @@ -992,19 +992,19 @@ function skynet.newservice(name, ...) return skynet.call(".launcher", "lua" , "LAUNCH", "snlua", name, ...) end -function skynet.uniqueservice(global, ...) - if global == true then +function skynet.uniqueservice(name, ...) + if name == true then return assert(skynet.call(".service", "lua", "GLAUNCH", ...)) else - return assert(skynet.call(".service", "lua", "LAUNCH", global, ...)) + return assert(skynet.call(".service", "lua", "LAUNCH", name, ...)) end end -function skynet.queryservice(global, ...) - if global == true then +function skynet.queryservice(name, ...) + if name == true then return assert(skynet.call(".service", "lua", "GQUERY", ...)) else - return assert(skynet.call(".service", "lua", "QUERY", global, ...)) + return assert(skynet.call(".service", "lua", "QUERY", name, ...)) end end diff --git a/lualib/skynet/db/redis.lua b/lualib/skynet/db/redis.lua index 8aad0856..36e199e1 100644 --- a/lualib/skynet/db/redis.lua +++ b/lualib/skynet/db/redis.lua @@ -213,10 +213,11 @@ end local function compose_table(lines, msg) local tinsert = table.insert tinsert(lines, count_cache[#msg]) + local val for _,v in ipairs(msg) do - v = tostring(v) - tinsert(lines,header_cache[#v]) - tinsert(lines,v) + val = tostring(v) + tinsert(lines,header_cache[#val]) + tinsert(lines,val) end tinsert(lines, "\r\n") return lines diff --git a/lualib/skynet/dns.lua b/lualib/skynet/dns.lua index 3e112964..403b43cb 100644 --- a/lualib/skynet/dns.lua +++ b/lualib/skynet/dns.lua @@ -130,11 +130,11 @@ local function parse_hosts() end for host in hosts:gmatch("%S+") do - host = host:lower() - local rt = rts[host] + local h = host:lower() + local rt = rts[h] if not rt then rt = {} - rts[host] = rt + rts[h] = rt end if not rt[family] then diff --git a/lualib/snax/hotfix.lua b/lualib/snax/hotfix.lua index 910fbda3..e31bcb16 100644 --- a/lualib/snax/hotfix.lua +++ b/lualib/snax/hotfix.lua @@ -40,16 +40,16 @@ local function collect_uv(f , uv, env) end local function collect_all_uv(funcs) - local global = {} + local globals = {} for _, v in pairs(funcs) do if v[4] then - collect_uv(v[4], global, envid(v[4])) + collect_uv(v[4], globals, envid(v[4])) end end - if not global["_ENV"] then - global["_ENV"] = {func = collect_uv, index = 1} + if not globals["_ENV"] then + globals["_ENV"] = {func = collect_uv, index = 1} end - return global + return globals end local function loader(source) @@ -70,40 +70,40 @@ end local dummy_env = {} for k,v in pairs(_ENV) do dummy_env[k] = v end -local function _patch(global, f) +local function _patch(globals, f) local i = 1 while true do local name, value = debug.getupvalue(f, i) if name == nil then break elseif value == nil or value == dummy_env then - local old_uv = global[name] + local old_uv = globals[name] if old_uv then debug.upvaluejoin(f, i, old_uv.func, old_uv.index) end else if type(value) == "function" then - _patch(global, value) + _patch(globals, value) end end i = i + 1 end end -local function patch_func(funcs, global, group, name, f) +local function patch_func(funcs, globals, group, name, f) local desc = assert(find_func(funcs, group, name) , string.format("Patch mismatch %s.%s", group, name)) - _patch(global, f) + _patch(globals, f) desc[4] = f end local function inject(funcs, source, ...) local patch = si("patch", dummy_env, loader(source)) - local global = collect_all_uv(funcs) + local globals = collect_all_uv(funcs) for _, v in pairs(patch) do local _, group, name, f = table.unpack(v) if f then - patch_func(funcs, global, group, name, f) + patch_func(funcs, globals, group, name, f) end end diff --git a/service/clusterd.lua b/service/clusterd.lua index 82b19f5c..ae410601 100644 --- a/service/clusterd.lua +++ b/service/clusterd.lua @@ -102,9 +102,9 @@ local function loadconfig(tmp) local reload = {} for name,address in pairs(tmp) do if name:sub(1,2) == "__" then - name = name:sub(3) - config[name] = address - skynet.error(string.format("Config %s = %s", name, address)) + local opt = name:sub(3) + config[opt] = address + skynet.error(string.format("Config %s = %s", opt, address)) else assert(address == false or type(address) == "string") if node_address[name] ~= address then diff --git a/service/service_mgr.lua b/service/service_mgr.lua index 09345955..71280f0a 100644 --- a/service/service_mgr.lua +++ b/service/service_mgr.lua @@ -96,10 +96,11 @@ function cmd.QUERY(service_name, subname) end local function list_service() + local val local result = {} for k,v in pairs(service) do if type(v) == "string" then - v = "Error: " .. v + val = "Error: " .. v elseif type(v) == "table" then local querying = {} if v.launch then @@ -118,12 +119,12 @@ local function list_service() table.insert(querying, skynet.address(detail.source) .. " " .. tostring(skynet.call(detail.source, "debug", "TASK", detail.session))) end end - v = table.concat(querying, "\n") + val = table.concat(querying, "\n") else - v = skynet.address(v) + val = skynet.address(v) end - result[k] = v + result[k] = val end return result