mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
@@ -122,7 +122,7 @@ local function dispatch_wakeup()
|
||||
local session = sleep_session[co]
|
||||
if session then
|
||||
session_id_coroutine[session] = "BREAK"
|
||||
return suspend(co, coroutine.resume(co, true))
|
||||
return suspend(co, coroutine.resume(co, true, "BREAK"))
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -246,7 +246,8 @@ function skynet.sleep(ti)
|
||||
session = tonumber(session)
|
||||
local succ, ret = coroutine_yield("SLEEP", session)
|
||||
sleep_session[coroutine.running()] = nil
|
||||
if ret == true then
|
||||
assert(succ, ret)
|
||||
if ret == "BREAK" then
|
||||
return "BREAK"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -96,7 +96,7 @@ function gateserver.start(handler)
|
||||
|
||||
function MSG.error(fd, msg)
|
||||
if handler.error then
|
||||
handler.error(fd)
|
||||
handler.error(fd, msg)
|
||||
end
|
||||
close_fd(fd)
|
||||
end
|
||||
|
||||
@@ -32,15 +32,18 @@ end
|
||||
|
||||
local CMD = {}
|
||||
|
||||
local env_mt = { __index = _ENV }
|
||||
|
||||
function CMD.new(name, t)
|
||||
local dt = type(t)
|
||||
local value
|
||||
if dt == "table" then
|
||||
value = t
|
||||
elseif dt == "string" then
|
||||
value = {}
|
||||
local f = load(t, "=" .. name, "t", env)
|
||||
value = setmetatable({}, env_mt)
|
||||
local f = load(t, "=" .. name, "t", value)
|
||||
f()
|
||||
setmetatable(value, nil)
|
||||
elseif dt == "nil" then
|
||||
value = {}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user