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