mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-10-30 16:27:36 +08:00
适配ZLToolKit最新代码
This commit is contained in:
parent
1823203509
commit
d9965b23ec
@ -1 +1 @@
|
||||
Subproject commit 8fea744fdfcce0437ef1bb6429636d58a6a44a10
|
||||
Subproject commit 205c03ebb69ce7319352a74a8d67f8ddcda8368a
|
@ -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
|
||||
|
@ -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");//鉴权失败
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user