Update skynet.lua
update skynet.ret
@@ -633,6 +633,9 @@ function skynet.ret(msg, sz)
local tag = session_coroutine_tracetag[running_thread]
if tag then c.trace(tag, "response") end
local co_session = session_coroutine_id[running_thread]
+ if co_session == nil then
+ error "No session"
+ end
session_coroutine_id[running_thread] = nil
if co_session == 0 then
if sz ~= nil then
@@ -641,9 +644,6 @@ function skynet.ret(msg, sz)
return false -- send don't need ret
end
local co_address = session_coroutine_address[running_thread]
- if not co_session then
- error "No session"
- end
local ret = c.send(co_address, skynet.PTYPE_RESPONSE, co_session, msg, sz)
if ret then
return true
