bugfix: remote object support term signal

This commit is contained in:
云风
2013-12-09 21:25:22 +08:00
parent 053e1e6b44
commit 294f6feb50

View File

@@ -172,7 +172,7 @@ function skynet.sleep(ti)
local session = c.command("TIMEOUT",tostring(ti)) local session = c.command("TIMEOUT",tostring(ti))
assert(session) assert(session)
session = tonumber(session) session = tonumber(session)
local ret = coroutine_yield("SLEEP", session) local succ, ret = coroutine_yield("SLEEP", session)
sleep_session[coroutine.running()] = nil sleep_session[coroutine.running()] = nil
if ret == true then if ret == true then
c.trace_switch(trace_handle, session) c.trace_switch(trace_handle, session)
@@ -486,8 +486,12 @@ do
local addr = remote_query(t.__remote) local addr = remote_query(t.__remote)
-- the proto is 11 (lua is 10) -- the proto is 11 (lua is 10)
local session = assert(_send(addr, 11 , nil, _pack(t,method,...)), "call to invalid address") local session = assert(_send(addr, 11 , nil, _pack(t,method,...)), "call to invalid address")
local msg, sz = coroutine_yield(session) local succ, msg, sz = coroutine_yield("CALL", session)
if succ then
return select(2,assert(_unpack(msg,sz))) return select(2,assert(_unpack(msg,sz)))
else
error "call to dead remote object"
end
end end
remote_call_func[method] = f remote_call_func[method] = f
end end