mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
change skynet_send api (use uint32_t instead of string)
This commit is contained in:
@@ -2,7 +2,7 @@ local skynet = require "skynet"
|
||||
|
||||
skynet.dispatch(function(msg, sz , session , from)
|
||||
local message = skynet.tostring(msg,sz)
|
||||
print("[GLOBALLOG]", from,message)
|
||||
print("[GLOBALLOG]", skynet.address(from),message)
|
||||
end)
|
||||
|
||||
skynet.register "LOG"
|
||||
@@ -5,20 +5,12 @@ skynet.dispatch()
|
||||
skynet.start(function()
|
||||
print("Server start")
|
||||
local lualog = skynet.launch("snlua","lualog")
|
||||
print("lualog",lualog)
|
||||
local launcher = skynet.launch("snlua","launcher")
|
||||
print("launcher", launcher)
|
||||
local remoteroot = skynet.launch("snlua","remote_root")
|
||||
print("remoteroot", remoteroot)
|
||||
local console = skynet.launch("snlua","console")
|
||||
print("console",console)
|
||||
local watchdog = skynet.launch("snlua","watchdog","8888 4 0")
|
||||
print("watchdog",watchdog)
|
||||
local db = skynet.launch("snlua","simpledb")
|
||||
print("simpledb",db)
|
||||
local connection = skynet.launch("connection","256")
|
||||
print("connection",connection)
|
||||
local redis = skynet.launch("snlua","redis-mgr")
|
||||
print("redis",redis)
|
||||
skynet.exit()
|
||||
end)
|
||||
|
||||
@@ -2,7 +2,6 @@ local skynet = require "skynet"
|
||||
|
||||
print("Log server start")
|
||||
|
||||
local log = skynet.launch("snlua","globallog")
|
||||
print("log",log)
|
||||
skynet.launch("snlua","globallog")
|
||||
|
||||
skynet.exit()
|
||||
|
||||
@@ -15,7 +15,7 @@ end
|
||||
|
||||
skynet.dispatch(function(msg, sz , session, from)
|
||||
local message = skynet.tostring(msg,sz)
|
||||
print("simpledb",message, from, session)
|
||||
print("simpledb",message, skynet.address(from), session)
|
||||
local cmd, key , value = string.match(message, "(%w+) (%w+) ?(.*)")
|
||||
local f = command[cmd]
|
||||
if f then
|
||||
|
||||
@@ -10,12 +10,10 @@ function command:open(parm)
|
||||
fd = tonumber(fd)
|
||||
print("agent open",self,string.format("%d %d %s",self,fd,addr))
|
||||
local client = skynet.launch("client",fd)
|
||||
print("client",client)
|
||||
local agent = skynet.launch("snlua","agent",client)
|
||||
print("watchdog launch agent client:",agent,client)
|
||||
local agent = skynet.launch("snlua","agent",skynet.address(client))
|
||||
if agent then
|
||||
agent_all[self] = { agent , client }
|
||||
skynet.send(gate, "forward ".. self .. " " .. agent .. " " .. client)
|
||||
skynet.send(gate, "forward ".. self .. " " .. skynet.address(agent) .. " " .. skynet.address(client))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -50,8 +48,7 @@ skynet.dispatch(function(msg, sz, session, address)
|
||||
end)
|
||||
|
||||
skynet.start(function()
|
||||
gate = skynet.launch("gate" , skynet.self(), port, max_agent, buffer)
|
||||
print("gate = ", gate)
|
||||
gate = skynet.launch("gate" , skynet.address(skynet.self()), port, max_agent, buffer)
|
||||
skynet.send(gate,"start")
|
||||
skynet.register(".watchdog")
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user