From 3074dbea0b4556163cc3c41be8c1eaa96e1b1f0c Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Thu, 18 Sep 2014 11:44:12 +0800 Subject: [PATCH] bugfix: wakeup sleep coroutine should return BREAK --- lualib/skynet.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lualib/skynet.lua b/lualib/skynet.lua index f700ba45..78f5bef9 100644 --- a/lualib/skynet.lua +++ b/lualib/skynet.lua @@ -122,7 +122,7 @@ local function dispatch_wakeup() local session = sleep_session[co] if session then session_id_coroutine[session] = "BREAK" - return suspend(co, coroutine.resume(co, true)) + return suspend(co, coroutine.resume(co, true, "BREAK")) end end end @@ -246,7 +246,8 @@ function skynet.sleep(ti) session = tonumber(session) local succ, ret = coroutine_yield("SLEEP", session) sleep_session[coroutine.running()] = nil - if ret == true then + assert(succ, ret) + if ret == "BREAK" then return "BREAK" end end