适配ZLToolKit最新代码

This commit is contained in:
xiongziliang 2019-02-11 16:24:05 +08:00
parent 1823203509
commit d9965b23ec
3 changed files with 8 additions and 8 deletions

@ -1 +1 @@
Subproject commit 8fea744fdfcce0437ef1bb6429636d58a6a44a10
Subproject commit 205c03ebb69ce7319352a74a8d67f8ddcda8368a

View File

@ -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

View File

@ -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");//鉴权失败
});