mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 11:03:12 +00:00
27 lines
490 B
Lua
27 lines
490 B
Lua
local skynet = require "skynet"
|
|
|
|
local mode = ...
|
|
|
|
if mode == "test" then
|
|
|
|
skynet.start(function()
|
|
skynet.dispatch("lua", function (...)
|
|
print("====>", ...)
|
|
skynet.exit()
|
|
end)
|
|
end)
|
|
|
|
else
|
|
|
|
skynet.start(function()
|
|
local test = skynet.newservice(SERVICE_NAME, "test") -- launch self in test mode
|
|
|
|
print(pcall(function()
|
|
skynet.send(test,"lua", "hello world")
|
|
skynet.send(test,"lua", "never get there")
|
|
skynet.call(test,"lua", "fake call")
|
|
end))
|
|
|
|
skynet.exit()
|
|
end)
|
|
end |