From 82fa2f979c7852f6a583e7b970c0486474fb9107 Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Tue, 12 May 2015 23:15:03 +0800 Subject: [PATCH] skynet.exit will call every unresponse handle --- lualib/skynet.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lualib/skynet.lua b/lualib/skynet.lua index fa1087d2..64aaa603 100644 --- a/lualib/skynet.lua +++ b/lualib/skynet.lua @@ -44,6 +44,7 @@ local session_id_coroutine = {} local session_coroutine_id = {} local session_coroutine_address = {} local session_response = {} +local unresponse = {} local wakeup_session = {} local sleep_session = {} @@ -224,11 +225,13 @@ function suspend(co, result, command, param, size) ret = false end release_watching(co_address) + unresponse[response] = nil f = nil return ret end watching_service[co_address] = watching_service[co_address] + 1 session_response[co] = response + unresponse[response] = true return suspend(co, coroutine.resume(co, response)) elseif command == "EXIT" then -- coroutine exit @@ -361,6 +364,9 @@ function skynet.exit() c.redirect(address, 0, skynet.PTYPE_ERROR, session, "") end end + for resp in pairs(unresponse) do + resp(false) + end -- report the sources I call but haven't return local tmp = {} for session, address in pairs(watching_session) do