From d9965b23ec1685ff97d399867c7492327b6a4723 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Mon, 11 Feb 2019 16:24:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8DZLToolKit=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZLToolKit | 2 +- tests/test_httpApi.cpp | 2 +- tests/test_server.cpp | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ZLToolKit b/ZLToolKit index 8fea744f..205c03eb 160000 --- a/ZLToolKit +++ b/ZLToolKit @@ -1 +1 @@ -Subproject commit 8fea744fdfcce0437ef1bb6429636d58a6a44a10 +Subproject commit 205c03ebb69ce7319352a74a8d67f8ddcda8368a diff --git a/tests/test_httpApi.cpp b/tests/test_httpApi.cpp index 44750ca1..bb5aed49 100644 --- a/tests/test_httpApi.cpp +++ b/tests/test_httpApi.cpp @@ -88,7 +88,7 @@ static onceToken s_token([](){ auto contentOut = printer << endl; ////////////////我们测算异步回复,当然你也可以同步回复///////////////// - EventPoller::Instance().sync([invoker,contentOut](){ + EventPollerPool::Instance().getPoller()->async([invoker,contentOut](){ HttpSession::KeyValue headerOut; //你可以自定义header,如果跟默认header重名,则会覆盖之 //默认header有:Server,Connection,Date,Content-Type,Content-Length diff --git a/tests/test_server.cpp b/tests/test_server.cpp index 53abdd47..e9d38078 100644 --- a/tests/test_server.cpp +++ b/tests/test_server.cpp @@ -107,14 +107,14 @@ static onceToken s_token([](){ DebugL << "RTSP是否需要鉴权事件:" << args._schema << " " << args._vhost << " " << args._app << " " << args._streamid << " " << args._param_strs ; if(string("1") == args._streamid ){ // live/1需要认证 - EventPoller::Instance().async([invoker](){ + EventPollerPool::Instance().getPoller()->async([invoker](){ //该流需要认证,并且设置realm invoker(REALM); }); }else{ //我们异步执行invoker。 //有时我们要查询redis或数据库来判断该流是否需要认证,通过invoker的方式可以做到完全异步 - EventPoller::Instance().async([invoker](){ + EventPollerPool::Instance().getPoller()->async([invoker](){ //该流我们不需要认证 invoker(""); }); @@ -127,7 +127,7 @@ static onceToken s_token([](){ DebugL << "RTSP用户:" << user_name << (must_no_encrypt ? " Base64" : " MD5" )<< " 方式登录"; string user = user_name; //假设我们异步读取数据库 - EventPoller::Instance().async([must_no_encrypt,invoker,user](){ + EventPollerPool::Instance().getPoller()->async([must_no_encrypt,invoker,user](){ if(user == "test0"){ //假设数据库保存的是明文 invoker(false,"pwd0"); @@ -156,7 +156,7 @@ static onceToken s_token([](){ //监听rtsp/rtmp推流事件,返回结果告知是否有推流权限 NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastMediaPublish,[](BroadcastMediaPublishArgs){ DebugL << "推流鉴权:" << args._schema << " " << args._vhost << " " << args._app << " " << args._streamid << " " << args._param_strs ; - EventPoller::Instance().async([invoker](){ + EventPollerPool::Instance().getPoller()->async([invoker](){ invoker("");//鉴权成功 //invoker("this is auth failed message");//鉴权失败 }); @@ -165,7 +165,7 @@ static onceToken s_token([](){ //监听rtsp/rtsps/rtmp/http-flv播放事件,返回结果告知是否有播放权限(rtsp通过kBroadcastOnRtspAuth或此事件都可以实现鉴权) NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastMediaPlayed,[](BroadcastMediaPlayedArgs){ DebugL << "播放鉴权:" << args._schema << " " << args._vhost << " " << args._app << " " << args._streamid << " " << args._param_strs ; - EventPoller::Instance().async([invoker](){ + EventPollerPool::Instance().getPoller()->async([invoker](){ invoker("");//鉴权成功 //invoker("this is auth failed message");//鉴权失败 }); @@ -174,7 +174,7 @@ static onceToken s_token([](){ //shell登录事件,通过shell可以登录进服务器执行一些命令 NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastShellLogin,[](BroadcastShellLoginArgs){ DebugL << "shell login:" << user_name << " " << passwd; - EventPoller::Instance().async([invoker](){ + EventPollerPool::Instance().getPoller()->async([invoker](){ invoker("");//鉴权成功 //invoker("this is auth failed message");//鉴权失败 });