mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
Add sproto:exist_type and sproto:exist_proto
This commit is contained in:
@@ -58,6 +58,15 @@ local function querytype(self, typename)
|
||||
return v
|
||||
end
|
||||
|
||||
function sproto:exist_type(typename)
|
||||
local v = self.__tcache[typename]
|
||||
if not v then
|
||||
return core.querytype(self.__cobj, typename) ~= nil
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function sproto:encode(typename, tbl)
|
||||
local st = querytype(self, typename)
|
||||
return core.encode(st, tbl)
|
||||
@@ -99,6 +108,15 @@ local function queryproto(self, pname)
|
||||
return v
|
||||
end
|
||||
|
||||
function sproto:exist_proto(pname)
|
||||
local v = self.__pcache[pname]
|
||||
if not v then
|
||||
return core.protocol(self.__cobj, pname) ~= nil
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function sproto:request_encode(protoname, tbl)
|
||||
local p = queryproto(self, protoname)
|
||||
local request = p.request
|
||||
|
||||
Reference in New Issue
Block a user