change source dir

This commit is contained in:
云风
2012-08-09 15:36:56 +08:00
parent d23c4aa905
commit eed9c42fd4
46 changed files with 284 additions and 118 deletions

27
service/launcher.lua Normal file
View File

@@ -0,0 +1,27 @@
local skynet = require "skynet"
local string = string
local instance = {}
skynet.dispatch(function(msg, sz , session, address)
local message = skynet.tostring(msg,sz)
if session == 0 then
-- init notice
local reply = instance[address]
if reply then
skynet.send(reply[2] , reply[1], address)
instance[address] = nil
end
else
-- launch request
local service, param = string.match(message, "([^ ]+) (.*)")
local inst = skynet.launch(service, param)
if inst then
instance[inst] = { session, address }
else
skynet.send(address, session)
end
end
end)
skynet.register(".launcher")