You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function REQUEST:get(args)
log(db)
print("get", args.what)
--local r = skynet.call("SIMPLEDB", "lua", "get", args.what)
--print(db[args.what])
print('----------------------')
--log(db)
return { result = "haha fake" }
end
function REQUEST:set(args)
-- local r = skynet.call("SIMPLEDB", "lua", "set", args.what, args.value)
db[args.what] = args.value;
// 就是这里了,如果不赋值就不会报crash
// 这里还有一个crash,就是把上面的get也打开,就更容易crash了
--print(db[args.what])
log(db)
end
local function request(name, args, response)
print(name, args, response)
if not env.module then
log('module dose not exist error')
return nil
end
-- 我们假设每一个name都是唯一的,也许未来要写一个工具,TODO 来检测proto中的name/tag都是唯一的
for _, v in pairs(env.module) do
local request = v.request
if type(request) == "table" then
local cb = request[name]
if cb ~= nil and type(cb) == "function" then
local isok, ret = pcall(cb, '', args)
if isok then
if response then
return response(ret)
else
return nil
end
end
end
end
end
return nil
The text was updated successfully, but these errors were encountered:
agent服务,处理client的请求,
local db = {}
function REQUEST:get(args)
log(db)
print("get", args.what)
--local r = skynet.call("SIMPLEDB", "lua", "get", args.what)
end
function REQUEST:set(args)
-- local r = skynet.call("SIMPLEDB", "lua", "set", args.what, args.value)
db[args.what] = args.value;
// 就是这里了,如果不赋值就不会报crash
// 这里还有一个crash,就是把上面的get也打开,就更容易crash了
end
local function request(name, args, response)
The text was updated successfully, but these errors were encountered: