mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
response error when return/response package is too large
This commit is contained in:
@@ -175,6 +175,10 @@ function suspend(co, result, command, param, size)
|
|||||||
local ret
|
local ret
|
||||||
if not dead_service[co_address] then
|
if not dead_service[co_address] then
|
||||||
ret = c.send(co_address, skynet.PTYPE_RESPONSE, co_session, param, size) ~= nil
|
ret = c.send(co_address, skynet.PTYPE_RESPONSE, co_session, param, size) ~= nil
|
||||||
|
if not ret then
|
||||||
|
-- If the package is too large, returns nil. so we should report error back
|
||||||
|
c.send(co_address, skynet.PTYPE_ERROR, co_session, "")
|
||||||
|
end
|
||||||
elseif size == nil then
|
elseif size == nil then
|
||||||
c.trash(param, size)
|
c.trash(param, size)
|
||||||
ret = false
|
ret = false
|
||||||
@@ -209,6 +213,10 @@ function suspend(co, result, command, param, size)
|
|||||||
if not dead_service[co_address] then
|
if not dead_service[co_address] then
|
||||||
if ok then
|
if ok then
|
||||||
ret = c.send(co_address, skynet.PTYPE_RESPONSE, co_session, f(...)) ~= nil
|
ret = c.send(co_address, skynet.PTYPE_RESPONSE, co_session, f(...)) ~= nil
|
||||||
|
if not ret then
|
||||||
|
-- If the package is too large, returns false. so we should report error back
|
||||||
|
c.send(co_address, skynet.PTYPE_ERROR, co_session, "")
|
||||||
|
end
|
||||||
else
|
else
|
||||||
ret = c.send(co_address, skynet.PTYPE_ERROR, co_session, "") ~= nil
|
ret = c.send(co_address, skynet.PTYPE_ERROR, co_session, "") ~= nil
|
||||||
end
|
end
|
||||||
@@ -405,7 +413,7 @@ local function yield_call(service, session)
|
|||||||
local succ, msg, sz = coroutine_yield("CALL", session)
|
local succ, msg, sz = coroutine_yield("CALL", session)
|
||||||
watching_session[session] = nil
|
watching_session[session] = nil
|
||||||
if not succ then
|
if not succ then
|
||||||
error(debug.traceback())
|
error "call failed"
|
||||||
end
|
end
|
||||||
return msg,sz
|
return msg,sz
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user