mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 04:33:05 +00:00
change name from exit to error
This commit is contained in:
@@ -28,7 +28,7 @@ local sleep_session = {}
|
|||||||
|
|
||||||
local watching_service = {}
|
local watching_service = {}
|
||||||
local watching_session = {}
|
local watching_session = {}
|
||||||
local exit_queue = {}
|
local error_queue = {}
|
||||||
|
|
||||||
-- suspend is function
|
-- suspend is function
|
||||||
local suspend
|
local suspend
|
||||||
@@ -42,8 +42,8 @@ end
|
|||||||
|
|
||||||
----- monitor exit
|
----- monitor exit
|
||||||
|
|
||||||
local function dispatch_exit()
|
local function dispatch_error_queue()
|
||||||
local session = table.remove(exit_queue,1)
|
local session = table.remove(error_queue,1)
|
||||||
if session then
|
if session then
|
||||||
local co = session_id_coroutine[session]
|
local co = session_id_coroutine[session]
|
||||||
session_id_coroutine[session] = nil
|
session_id_coroutine[session] = nil
|
||||||
@@ -52,12 +52,12 @@ local function dispatch_exit()
|
|||||||
end
|
end
|
||||||
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
|
-- Don't remove from watching_service , because user may call dead service
|
||||||
watching_service[service] = false
|
watching_service[service] = false
|
||||||
for session, srv in pairs(watching_session) do
|
for session, srv in pairs(watching_session) do
|
||||||
if srv == service then
|
if srv == service then
|
||||||
table.insert(exit_queue, session)
|
table.insert(error_queue, session)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -156,7 +156,7 @@ function suspend(co, result, command, param, size)
|
|||||||
end
|
end
|
||||||
trace_count()
|
trace_count()
|
||||||
dispatch_wakeup()
|
dispatch_wakeup()
|
||||||
dispatch_exit()
|
dispatch_error_queue()
|
||||||
end
|
end
|
||||||
|
|
||||||
function skynet.timeout(ti, func)
|
function skynet.timeout(ti, func)
|
||||||
@@ -636,11 +636,11 @@ do
|
|||||||
}
|
}
|
||||||
|
|
||||||
REG {
|
REG {
|
||||||
name = "exit",
|
name = "error",
|
||||||
id = 7,
|
id = 7,
|
||||||
pack = skynet.pack,
|
pack = skynet.pack,
|
||||||
unpack = skynet.unpack,
|
unpack = skynet.unpack,
|
||||||
dispatch = _exit_dispatch,
|
dispatch = _error_dispatch,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ skynet.register_protocol {
|
|||||||
local w = service_map[address]
|
local w = service_map[address]
|
||||||
if w then
|
if w then
|
||||||
for watcher in pairs(w) do
|
for watcher in pairs(w) do
|
||||||
skynet.send(watcher, "exit", address)
|
skynet.send(watcher, "error", address)
|
||||||
end
|
end
|
||||||
service_map[address] = false
|
service_map[address] = false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#define PTYPE_HARBOR 5
|
#define PTYPE_HARBOR 5
|
||||||
#define PTYPE_SOCKET 6
|
#define PTYPE_SOCKET 6
|
||||||
// read lualib/skynet.lua lualib/simplemonitor.lua
|
// read lualib/skynet.lua lualib/simplemonitor.lua
|
||||||
#define PTYPE_EXIT 7
|
#define PTYPE_RESERVED_ERROR 7
|
||||||
// read lualib/skynet.lua lualib/mqueue.lua
|
// read lualib/skynet.lua lualib/mqueue.lua
|
||||||
#define PTYPE_RESERVED_QUEUE 8
|
#define PTYPE_RESERVED_QUEUE 8
|
||||||
#define PTYPE_RESERVED_DEBUG 9
|
#define PTYPE_RESERVED_DEBUG 9
|
||||||
|
|||||||
Reference in New Issue
Block a user