支持全局的禁用虚拟主机

This commit is contained in:
xiongziliang
2019-05-28 17:14:36 +08:00
parent 2f976214ce
commit a100ee0acd
23 changed files with 173 additions and 124 deletions

View File

@@ -61,7 +61,7 @@ void MediaSource::findAsync(const MediaInfo &info,
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastNotFoundStream,info,*session);
//最多等待一定时间,如果这个时间内,流未注册上,那么返回未找到流
GET_CONFIG_AND_REGISTER(int,maxWaitMS,Broadcast::kMaxStreamWaitTimeMS);
GET_CONFIG(int,maxWaitMS,General::kMaxStreamWaitTimeMS);
//若干秒后执行等待媒体注册超时回调
auto onRegistTimeout = session->getPoller()->doDelayTask(maxWaitMS,[cb,listener_tag](){
@@ -112,6 +112,12 @@ MediaSource::Ptr MediaSource::find(
if(vhost.empty()){
vhost = DEFAULT_VHOST;
}
GET_CONFIG(bool,enableVhost,General::kEnableVhost);
if(!enableVhost){
vhost = DEFAULT_VHOST;
}
lock_guard<recursive_mutex> lock(g_mtxMediaSrc);
MediaSource::Ptr ret;
searchMedia(schema, vhost, app, id,
@@ -135,6 +141,10 @@ MediaSource::Ptr MediaSource::find(
return ret;
}
void MediaSource::regist() {
GET_CONFIG(bool,enableVhost,General::kEnableVhost);
if(!enableVhost){
_strVhost = DEFAULT_VHOST;
}
//注册该源,注册后服务器才能找到该源
{
lock_guard<recursive_mutex> lock(g_mtxMediaSrc);
@@ -229,6 +239,10 @@ void MediaInfo::parse(const string &url){
_vhost = DEFAULT_VHOST;
}
}
GET_CONFIG(bool,enableVhost,General::kEnableVhost);
if(!enableVhost){
_vhost = DEFAULT_VHOST;
}
}