exit monitor

This commit is contained in:
云风
2013-08-06 13:44:41 +08:00
parent 6be6a8171f
commit ff6e4dc762
5 changed files with 65 additions and 10 deletions

View File

@@ -4,6 +4,7 @@ skynet.start(function()
print("Server start")
skynet.launch("socket",128)
local service = skynet.newservice("service_mgr")
skynet.monitor "simplemonitor"
local lualog = skynet.newservice("lualog")
local console = skynet.newservice("console")
local remoteroot = skynet.newservice("remote_root")

View File

@@ -2,11 +2,12 @@ local skynet = require "skynet"
skynet.start(function()
print("Log server start")
-- local connection = skynet.launch("connection","256")
skynet.launch("socket",128)
local lualog = skynet.launch("snlua","lualog")
local console = skynet.launch("snlua","console")
local log = skynet.launch("snlua","globallog")
local service = skynet.newservice("service_mgr")
skynet.monitor "simplemonitor"
local lualog = skynet.newservice("lualog")
local console = skynet.newservice("console")
local log = skynet.newservice("globallog")
-- skynet.launch("snlua","testgroup_c 11 1")
skynet.exit()
end)

14
service/simplemonitor.lua Normal file
View File

@@ -0,0 +1,14 @@
local skynet = require "skynet"
-- It's a simple service exit monitor, you can do something more when a service exit.
skynet.register_protocol {
name = "client",
id = 3,
unpack = function() end,
dispatch = function(_, address)
print(string.format("[:%x] exit", address))
end
}
skynet.start(function() end)