Files
skynet/agent.lua
2012-08-09 11:36:39 +08:00

18 lines
390 B
Lua

local skynet = require "skynet"
local client = ...
skynet.dispatch(function(msg, sz , session, address)
local message = skynet.tostring(msg,sz)
if session == 0 then
print("client command",msg)
local result = skynet.call("SIMPLEDB",msg)
skynet.send(client, result)
else
print("server command",msg)
if msg == "CLOSE" then
skynet.kill(client)
skynet.exit()
end
end
end)