mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 12:20:41 +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)
|
v0.4.0 (2014-6-30)
|
||||||
-----------
|
-----------
|
||||||
* Optimize redis driver `compose_message`.
|
* Optimize redis driver `compose_message`.
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ for word in string.gmatch(..., "%S+") do
|
|||||||
table.insert(args, word)
|
table.insert(args, word)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
SERVICE_NAME = args[1]
|
||||||
|
|
||||||
local main, pattern
|
local main, pattern
|
||||||
|
|
||||||
local err = {}
|
local err = {}
|
||||||
for pat in string.gmatch(LUA_SERVICE, "([^;]+);*") do
|
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)
|
local f, msg = loadfile(filename)
|
||||||
if not f then
|
if not f then
|
||||||
table.insert(err, msg)
|
table.insert(err, msg)
|
||||||
|
|||||||
@@ -253,6 +253,13 @@ end
|
|||||||
|
|
||||||
function skynet.exit()
|
function skynet.exit()
|
||||||
skynet.send(".launcher","lua","REMOVE",skynet.self())
|
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")
|
c.command("EXIT")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ end)
|
|||||||
else
|
else
|
||||||
|
|
||||||
skynet.start(function()
|
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()
|
print(pcall(function()
|
||||||
skynet.send(test,"lua", "hello world")
|
skynet.send(test,"lua", "hello world")
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ skynet.start(function()
|
|||||||
local channel = mc.new()
|
local channel = mc.new()
|
||||||
print("New channel", channel)
|
print("New channel", channel)
|
||||||
for i=1,10 do
|
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)
|
skynet.call(sub, "lua", "init", channel.channel)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user