Update to lua 5.4 (#1174)

* update to lua 5.4.0-rc1

* remove LUA_ERRGCMM

* use age bits for shared

* remove unused lbitlib.c

* use luaV_fastget

* fix #1174

* suspend函数tailcall优化

* 防止没有session导致未调用suspend

* luaH_setint check shared (#1184)

* set LUA_GCGEN by default

* fix #1174 (#1186)

checkshared in sweeplist

* update to lua 5.4 rc2

* update to lua 5.4 rc4

* move skynet.profile into snlua

* Use lua_sethook to interrupt tight loops

* remove lua_checksig

* critical condition for signals

* update to lua 5.4 released

* lua 5.4 bugfix

* update lua bugfix

* fix lua_sharestring (#1224)

* update lua

* update lua 5.4

* update README

* add skynet.select

* add test

* test error & discard

* yield session

* request error has no error message

* add timeout to skynet.select

* bugfix

* for lua 5.4

* new version

* bugfix

* bugfix

* use if instead of while

* make local

* yield in select for

* update lua 5.4.1

* change lua version (#1245)

Co-authored-by: xiaojin <xiaojin@onemt.com.cn>

* update lua version number

Co-authored-by: hong <hongling0@gmail.com>
Co-authored-by: hong <hongling-0@qq.com>
Co-authored-by: 风---自由 <996442717qqcom@gmail.com>
Co-authored-by: xiaojin <xiaojin@onemt.com.cn>
This commit is contained in:
云风
2020-10-10 13:36:59 +08:00
committed by GitHub
parent eef2b1fc62
commit eaa60ca8dd
77 changed files with 11277 additions and 5962 deletions

View File

@@ -11,6 +11,7 @@ local arg = table.pack(...)
assert(arg.n <= 2)
local ip = (arg.n == 2 and arg[1] or "127.0.0.1")
local port = tonumber(arg[arg.n])
local TIMEOUT = 300 -- 3 sec
local COMMAND = {}
local COMMANDX = {}
@@ -224,20 +225,32 @@ function COMMAND.list()
return skynet.call(".launcher", "lua", "LIST")
end
function COMMAND.stat()
return skynet.call(".launcher", "lua", "STAT")
local function timeout(ti)
if ti then
ti = tonumber(ti)
if ti <= 0 then
ti = nil
end
else
ti = TIMEOUT
end
return ti
end
function COMMAND.mem()
return skynet.call(".launcher", "lua", "MEM")
function COMMAND.stat(ti)
return skynet.call(".launcher", "lua", "STAT", timeout(ti))
end
function COMMAND.mem(ti)
return skynet.call(".launcher", "lua", "MEM", timeout(ti))
end
function COMMAND.kill(address)
return skynet.call(".launcher", "lua", "KILL", address)
end
function COMMAND.gc()
return skynet.call(".launcher", "lua", "GC")
function COMMAND.gc(ti)
return skynet.call(".launcher", "lua", "GC", timeout(ti))
end
function COMMAND.exit(address)

View File

@@ -22,18 +22,35 @@ function command.LIST()
return list
end
function command.STAT()
local function list_srv(ti, fmt_func, ...)
local list = {}
for k,v in pairs(services) do
local ok, stat = pcall(skynet.call,k,"debug","STAT")
if not ok then
stat = string.format("ERROR (%s)",v)
local sessions = {}
local req = skynet.request()
for addr in pairs(services) do
local r = { addr, "debug", ... }
req:add(r)
sessions[r] = addr
end
for resp, req in req:select(ti) do
local stat = resp[1]
local addr = req[1]
if resp.ok then
list[skynet.address(addr)] = fmt_func(stat, addr)
else
list[skynet.address(addr)] = fmt_func("ERROR", addr)
end
list[skynet.address(k)] = stat
sessions[req] = nil
end
for session, addr in pairs(sessions) do
list[skynet.address(addr)] = fmt_func("TIMEOUT", addr)
end
return list
end
function command.STAT(addr, ti)
return list_srv(ti, function(v) return v end, "STAT")
end
function command.KILL(_, handle)
handle = handle_to_address(handle)
skynet.kill(handle)
@@ -42,24 +59,22 @@ function command.KILL(_, handle)
return ret
end
function command.MEM()
local list = {}
for k,v in pairs(services) do
local ok, kb = pcall(skynet.call,k,"debug","MEM")
if not ok then
list[skynet.address(k)] = string.format("ERROR (%s)",v)
function command.MEM(addr, ti)
return list_srv(ti, function(kb, addr)
local v = services[addr]
if kb == "TIMEOUT" then
return string.format("TIMEOUT (%s)",v)
else
list[skynet.address(k)] = string.format("%.2f Kb (%s)",kb,v)
return string.format("%.2f Kb (%s)",kb,v)
end
end
return list
end, "MEM")
end
function command.GC()
function command.GC(addr, ti)
for k,v in pairs(services) do
skynet.send(k,"debug","GC")
end
return command.MEM()
return command.MEM(ti)
end
function command.REMOVE(_, handle, kill)