mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
sproto dispatch support ud
This commit is contained in:
@@ -197,6 +197,7 @@ function host:dispatch(...)
|
||||
local bin = core.unpack(...)
|
||||
header_tmp.type = nil
|
||||
header_tmp.session = nil
|
||||
header_tmp.ud = nil
|
||||
local header, size = core.decode(self.__package, bin, header_tmp)
|
||||
local content = bin:sub(size + 1)
|
||||
if header.type then
|
||||
@@ -207,9 +208,9 @@ function host:dispatch(...)
|
||||
result = core.decode(proto.request, content)
|
||||
end
|
||||
if header_tmp.session then
|
||||
return "REQUEST", proto.name, result, gen_response(self, proto.response, header_tmp.session)
|
||||
return "REQUEST", proto.name, result, gen_response(self, proto.response, header_tmp.session), header.ud
|
||||
else
|
||||
return "REQUEST", proto.name, result
|
||||
return "REQUEST", proto.name, result, nil, header.ud
|
||||
end
|
||||
else
|
||||
-- response
|
||||
@@ -217,10 +218,10 @@ function host:dispatch(...)
|
||||
local response = assert(self.__session[session], "Unknown session")
|
||||
self.__session[session] = nil
|
||||
if response == true then
|
||||
return "RESPONSE", session
|
||||
return "RESPONSE", session, nil, header.ud
|
||||
else
|
||||
local result = core.decode(response, content)
|
||||
return "RESPONSE", session, result
|
||||
return "RESPONSE", session, result, header.ud
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user