From 4a49346da8492da5ce10b2ebddfb919d3cf62c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=91=E9=A3=8E?= Date: Tue, 10 Dec 2013 14:59:03 +0800 Subject: [PATCH] change name from exit to error --- lualib/skynet.lua | 16 ++++++++-------- service/simplemonitor.lua | 2 +- skynet-src/skynet.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lualib/skynet.lua b/lualib/skynet.lua index c3a67a44..f2679055 100644 --- a/lualib/skynet.lua +++ b/lualib/skynet.lua @@ -28,7 +28,7 @@ local sleep_session = {} local watching_service = {} local watching_session = {} -local exit_queue = {} +local error_queue = {} -- suspend is function local suspend @@ -42,8 +42,8 @@ end ----- monitor exit -local function dispatch_exit() - local session = table.remove(exit_queue,1) +local function dispatch_error_queue() + local session = table.remove(error_queue,1) if session then local co = session_id_coroutine[session] session_id_coroutine[session] = nil @@ -52,12 +52,12 @@ local function dispatch_exit() end end -local function _exit_dispatch(session, monitor, service) +local function _error_dispatch(session, monitor, service) -- Don't remove from watching_service , because user may call dead service watching_service[service] = false for session, srv in pairs(watching_session) do if srv == service then - table.insert(exit_queue, session) + table.insert(error_queue, session) end end end @@ -156,7 +156,7 @@ function suspend(co, result, command, param, size) end trace_count() dispatch_wakeup() - dispatch_exit() + dispatch_error_queue() end function skynet.timeout(ti, func) @@ -636,11 +636,11 @@ do } REG { - name = "exit", + name = "error", id = 7, pack = skynet.pack, unpack = skynet.unpack, - dispatch = _exit_dispatch, + dispatch = _error_dispatch, } end diff --git a/service/simplemonitor.lua b/service/simplemonitor.lua index 8718d524..fa7ff844 100644 --- a/service/simplemonitor.lua +++ b/service/simplemonitor.lua @@ -12,7 +12,7 @@ skynet.register_protocol { local w = service_map[address] if w then for watcher in pairs(w) do - skynet.send(watcher, "exit", address) + skynet.send(watcher, "error", address) end service_map[address] = false end diff --git a/skynet-src/skynet.h b/skynet-src/skynet.h index 7c1b9ff8..b075690a 100644 --- a/skynet-src/skynet.h +++ b/skynet-src/skynet.h @@ -12,7 +12,7 @@ #define PTYPE_HARBOR 5 #define PTYPE_SOCKET 6 // read lualib/skynet.lua lualib/simplemonitor.lua -#define PTYPE_EXIT 7 +#define PTYPE_RESERVED_ERROR 7 // read lualib/skynet.lua lualib/mqueue.lua #define PTYPE_RESERVED_QUEUE 8 #define PTYPE_RESERVED_DEBUG 9