mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
complete cluster.send
This commit is contained in:
@@ -11,9 +11,11 @@ skynet.start(function()
|
||||
print(skynet.call(proxy, "lua", "SET", largekey, largevalue))
|
||||
local v = skynet.call(proxy, "lua", "GET", largekey)
|
||||
assert(largevalue == v)
|
||||
skynet.send(proxy, "lua", "PING", "proxy")
|
||||
|
||||
print(cluster.call("db", sdb, "GET", "a"))
|
||||
print(cluster.call("db2", sdb, "GET", "b"))
|
||||
cluster.send("db2", sdb, "PING", "db2:longstring" .. largevalue)
|
||||
|
||||
-- test snax service
|
||||
local pingserver = cluster.snax("db", "pingserver")
|
||||
|
||||
@@ -16,7 +16,17 @@ end
|
||||
|
||||
skynet.start(function()
|
||||
skynet.dispatch("lua", function(session, address, cmd, ...)
|
||||
local f = command[string.upper(cmd)]
|
||||
cmd = cmd:upper()
|
||||
if cmd == "PING" then
|
||||
assert(session == 0)
|
||||
local str = (...)
|
||||
if #str > 20 then
|
||||
str = str:sub(1,20) .. "...(" .. #str .. ")"
|
||||
end
|
||||
skynet.error(string.format("%s ping %s", skynet.address(address), str))
|
||||
return
|
||||
end
|
||||
local f = command[cmd]
|
||||
if f then
|
||||
skynet.ret(skynet.pack(f(...)))
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user