mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-23 19:43:09 +00:00
throw error when skynet.exit
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
Dev version
|
||||
-----------
|
||||
* add SERVICE_NAME in loader
|
||||
* throw error back when skynet.error
|
||||
|
||||
v0.4.0 (2014-6-30)
|
||||
-----------
|
||||
* Optimize redis driver `compose_message`.
|
||||
|
||||
@@ -3,11 +3,13 @@ for word in string.gmatch(..., "%S+") do
|
||||
table.insert(args, word)
|
||||
end
|
||||
|
||||
SERVICE_NAME = args[1]
|
||||
|
||||
local main, pattern
|
||||
|
||||
local err = {}
|
||||
for pat in string.gmatch(LUA_SERVICE, "([^;]+);*") do
|
||||
local filename = string.gsub(pat, "?", args[1])
|
||||
local filename = string.gsub(pat, "?", SERVICE_NAME)
|
||||
local f, msg = loadfile(filename)
|
||||
if not f then
|
||||
table.insert(err, msg)
|
||||
|
||||
@@ -253,6 +253,13 @@ end
|
||||
|
||||
function skynet.exit()
|
||||
skynet.send(".launcher","lua","REMOVE",skynet.self())
|
||||
for co, session in pairs(session_coroutine_id) do
|
||||
local address = session_coroutine_address[co]
|
||||
local self = skynet.self()
|
||||
if session~=0 and address then
|
||||
skynet.redirect(self, address, "error", session, "")
|
||||
end
|
||||
end
|
||||
c.command("EXIT")
|
||||
end
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ end)
|
||||
else
|
||||
|
||||
skynet.start(function()
|
||||
local test = skynet.newservice("testdeadcall", "test") -- launch self in test mode
|
||||
local test = skynet.newservice(SERVICE_NAME, "test") -- launch self in test mode
|
||||
|
||||
print(pcall(function()
|
||||
skynet.send(test,"lua", "hello world")
|
||||
|
||||
@@ -27,7 +27,7 @@ skynet.start(function()
|
||||
local channel = mc.new()
|
||||
print("New channel", channel)
|
||||
for i=1,10 do
|
||||
local sub = skynet.newservice("testmulticast", "sub")
|
||||
local sub = skynet.newservice(SERVICE_NAME, "sub")
|
||||
skynet.call(sub, "lua", "init", channel.channel)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user