update sproto , add new api sproto:default

This commit is contained in:
Cloud Wu
2015-05-11 18:20:17 +08:00
parent 9452169f0a
commit c7f5145e9e
2 changed files with 65 additions and 0 deletions

View File

@@ -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)