mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
update sproto , add new api sproto:default
This commit is contained in:
@@ -122,6 +122,21 @@ end
|
||||
sproto.pack = core.pack
|
||||
sproto.unpack = core.unpack
|
||||
|
||||
function sproto:default(typename, type)
|
||||
if type == nil then
|
||||
return core.default(querytype(self, typename))
|
||||
else
|
||||
local p = queryproto(self, typename)
|
||||
if type == "REQUEST" then
|
||||
return core.default(p.request)
|
||||
elseif type == "RESPONSE" then
|
||||
return core.default(p.response)
|
||||
else
|
||||
error "Invalid type"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local header_tmp = {}
|
||||
|
||||
local function gen_response(self, response, session)
|
||||
|
||||
Reference in New Issue
Block a user