From 8682f7f82f41304ee9d8b194157bfdd5efda7f43 Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Mon, 27 Apr 2015 16:23:12 +0800 Subject: [PATCH] response error when return/response package is too large --- lualib/skynet.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lualib/skynet.lua b/lualib/skynet.lua index d3cb623d..322c1da5 100644 --- a/lualib/skynet.lua +++ b/lualib/skynet.lua @@ -175,6 +175,10 @@ function suspend(co, result, command, param, size) local ret if not dead_service[co_address] then 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 c.trash(param, size) ret = false @@ -209,6 +213,10 @@ function suspend(co, result, command, param, size) if not dead_service[co_address] then if ok then 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 ret = c.send(co_address, skynet.PTYPE_ERROR, co_session, "") ~= nil end @@ -405,7 +413,7 @@ local function yield_call(service, session) local succ, msg, sz = coroutine_yield("CALL", session) watching_session[session] = nil if not succ then - error(debug.traceback()) + error "call failed" end return msg,sz end