add ping for client proxy

This commit is contained in:
zouchengzhuo 2022-05-05 01:40:06 +00:00
parent f5799d8369
commit 73c4045b1b
2 changed files with 16 additions and 0 deletions

View File

@ -60,6 +60,7 @@ void CodeGenerator::createFile(const string &file, const bool bEntry)
if (_bClient) if (_bClient)
{ {
addTarsPingForProxy(contexts[i]); // add tars_ping function for client proxy
if (_bTS) if (_bTS)
{ {
if (!generateTSProxy(contexts[i])) return; // generate .ts for proxy classes if (!generateTSProxy(contexts[i])) return; // generate .ts for proxy classes
@ -107,3 +108,16 @@ void CodeGenerator::createFile(const string &file, const bool bEntry)
} }
} }
} }
void CodeGenerator::addTarsPingForProxy(const ContextPtr &cPtr){
vector<NamespacePtr> namespaces = cPtr->getNamespaces();
string ping = TC_Common::lower(IDL_NAMESPACE_STR) + "_ping";
for(size_t i = 0; i < namespaces.size(); i++)
{
vector<InterfacePtr> & is = namespaces[i]->getAllInterfacePtr();
for (size_t ii = 0; ii < is.size(); ii++)
{
is[ii]->createOperation(ping, nullptr);
}
}
}

View File

@ -150,6 +150,8 @@ private:
void scan(const string & sFile, bool bNotPrefix); void scan(const string & sFile, bool bNotPrefix);
void addTarsPingForProxy(const ContextPtr &cPtr);
string makeName(); string makeName();
string findName(const string & sNamespace, const string & sName, const bool &bBase = false); string findName(const string & sNamespace, const string & sName, const bool &bBase = false);