update sproto to support empty request

This commit is contained in:
Cloud Wu
2014-09-07 18:44:04 +08:00
parent db9ab88a6c
commit 01269c88ff
5 changed files with 51 additions and 34 deletions

View File

@@ -126,11 +126,19 @@ function rpc:dispatch(...)
if header.type then
-- request
local proto = queryproto(self.__proto, header.type)
local result = core.decode(proto.request, content)
if header_tmp.session then
return "REQUEST", proto.name, result, gen_response(self, proto.response, header_tmp.session)
if proto.request then
local result = core.decode(proto.request, content)
if header_tmp.session then
return "REQUEST", proto.name, result, gen_response(self, proto.response, header_tmp.session)
else
return "REQUEST", proto.name, result
end
else
return "REQUEST", proto.name, result
if header_tmp.session then
return "REQUEST", proto.name, nil, gen_response(self, proto.response, header_tmp.session)
else
return "REQUEST", proto.name
end
end
else
-- response