mirror of
https://gitee.com/TarsCloud/TarsCpp.git
synced 2024-12-22 22:16:38 +08:00
fix TC_Coroutine rpc all not open co
fix co examples bug
This commit is contained in:
parent
aacc87a503
commit
8b6fc35145
@ -53,7 +53,7 @@
|
||||
|
||||
<BAdapter>
|
||||
#ip:port:timeout
|
||||
endpoint = tcp -h 127.0.0.1 -p 9100 -t 10000
|
||||
endpoint = tcp -h 127.0.0.1 -p 9200 -t 10000
|
||||
#allow ip
|
||||
allow =
|
||||
#max connection num
|
||||
|
@ -26,7 +26,7 @@ using namespace tars;
|
||||
|
||||
Communicator* _comm;
|
||||
|
||||
static string coroObj = "TestApp.BServer.BServantObj@tcp -h 127.0.0.1 -p 9100";
|
||||
static string coroObj = "TestApp.BServer.BServantObj@tcp -h 127.0.0.1 -p 9200";
|
||||
|
||||
struct Param
|
||||
{
|
||||
@ -112,7 +112,7 @@ void parallelCall(int c)
|
||||
//{
|
||||
// // _comm.setProperty("locator", "tars.tarsregistry.QueryObj@tcp -h 10.208.139.242 -p 17890 -t 10000");
|
||||
// // _comm.setProperty("stat", "tars.tarsstat.StatObj");
|
||||
// _prx = _comm.stringToProxy<BServantPrx>("TestApp.BServer.BServantObj@tcp -h 127.0.0.1 -p 9100");
|
||||
// _prx = _comm.stringToProxy<BServantPrx>("TestApp.BServer.BServantObj@tcp -h 127.0.0.1 -p 9200");
|
||||
//}
|
||||
//
|
||||
//Test1::~Test1()
|
||||
|
@ -43,7 +43,7 @@ TestCoroutine::TestCoroutine(int iNum)
|
||||
: _num(iNum)
|
||||
{
|
||||
// _comm.setProperty("locator", "tars.tarsregistry.QueryObj@tcp -h 10.208.139.242 -p 17890 -t 10000");
|
||||
_prx = _comm.stringToProxy<BServantPrx>("TestApp.BServer.BServantObj@tcp -h 127.0.0.1 -p 9100");
|
||||
_prx = _comm.stringToProxy<BServantPrx>("TestApp.BServer.BServantObj@tcp -h 127.0.0.1 -p 9200");
|
||||
// _comm.stringToProxy(_sObj, _prx);
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ TestCoroutine::TestCoroutine(int iNum)
|
||||
: _num(iNum)
|
||||
{
|
||||
// _comm.setProperty("locator", "tars.tarsregistry.QueryObj@tcp -h 10.208.139.242 -p 17890 -t 10000");
|
||||
_prx = _comm.stringToProxy<BServantPrx>("TestApp.BServer.BServantObj@tcp -h 127.0.0.1 -p 9100");
|
||||
_prx = _comm.stringToProxy<BServantPrx>("TestApp.BServer.BServantObj@tcp -h 127.0.0.1 -p 9200");
|
||||
// _comm.stringToProxy(_sObj, _prx);
|
||||
}
|
||||
|
||||
|
@ -30,12 +30,12 @@ sleep 1
|
||||
echo "client: ${EXE_PATH}/CoroutineDemoClient"
|
||||
|
||||
${EXE_PATH}/CoroutineDemoClient --count=10000 --call=serial --thread=2 --buffersize=100 --netthread=2
|
||||
|
||||
#
|
||||
${EXE_PATH}/CoroutineDemoClient --count=10000 --call=parallel --thread=2 --buffersize=100 --netthread=2
|
||||
|
||||
${EXE_PATH}/testCoro 1000
|
||||
|
||||
${EXE_PATH}/testParallelCoro 1000
|
||||
#
|
||||
#${EXE_PATH}/testCoro 1000
|
||||
#
|
||||
#${EXE_PATH}/testParallelCoro 1000
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -730,6 +730,7 @@ void Application::main(const string &config)
|
||||
#if TARGET_PLATFORM_LINUX || TARGET_PLATFORM_IOS
|
||||
TC_Common::ignorePipe();
|
||||
#endif
|
||||
__out__.modFlag(0xFFFF, false);
|
||||
|
||||
//解析配置文件
|
||||
parseConfig(config);
|
||||
|
@ -777,6 +777,12 @@ void ServantProxy::invoke(ReqMessage *msg, bool bCoroAsync)
|
||||
ServantProxyThreadData *pSptd = ServantProxyThreadData::getData();
|
||||
assert(pSptd != NULL);
|
||||
|
||||
//协程调用方式, 启用协程
|
||||
if(bCoroAsync && TC_CoroutineScheduler::scheduler() && !pSptd->_sched)
|
||||
{
|
||||
pSptd->_sched = TC_CoroutineScheduler::scheduler();
|
||||
}
|
||||
|
||||
msg->data = pSptd->move();
|
||||
|
||||
// 调用链追踪透传
|
||||
|
Loading…
Reference in New Issue
Block a user