winlin

specifies the try default vhost

@@ -418,8 +418,8 @@ int SrsRtmpConn::do_cycle() @@ -418,8 +418,8 @@ int SrsRtmpConn::do_cycle()
418 return ret; 418 return ret;
419 } 419 }
420 420
421 - // check vhost  
422 - if ((ret = check_vhost()) != ERROR_SUCCESS) { 421 + // check vhost, allow default vhost.
  422 + if ((ret = check_vhost(true)) != ERROR_SUCCESS) {
423 srs_error("check vhost failed. ret=%d", ret); 423 srs_error("check vhost failed. ret=%d", ret);
424 return ret; 424 return ret;
425 } 425 }
@@ -787,13 +787,13 @@ int SrsRtmpConn::stream_service_cycle() @@ -787,13 +787,13 @@ int SrsRtmpConn::stream_service_cycle()
787 return ret; 787 return ret;
788 } 788 }
789 789
790 -int SrsRtmpConn::check_vhost() 790 +int SrsRtmpConn::check_vhost(bool try_default_vhost)
791 { 791 {
792 int ret = ERROR_SUCCESS; 792 int ret = ERROR_SUCCESS;
793 793
794 srs_assert(req != NULL); 794 srs_assert(req != NULL);
795 795
796 - SrsConfDirective* vhost = _srs_config->get_vhost(req->vhost); 796 + SrsConfDirective* vhost = _srs_config->get_vhost(req->vhost, try_default_vhost);
797 if (vhost == NULL) { 797 if (vhost == NULL) {
798 ret = ERROR_RTMP_VHOST_NOT_FOUND; 798 ret = ERROR_RTMP_VHOST_NOT_FOUND;
799 srs_error("vhost %s not found. ret=%d", req->vhost.c_str(), ret); 799 srs_error("vhost %s not found. ret=%d", req->vhost.c_str(), ret);
@@ -171,7 +171,7 @@ private: @@ -171,7 +171,7 @@ private:
171 virtual int service_cycle(); 171 virtual int service_cycle();
172 // stream(play/publish) service cycle, identify client first. 172 // stream(play/publish) service cycle, identify client first.
173 virtual int stream_service_cycle(); 173 virtual int stream_service_cycle();
174 - virtual int check_vhost(); 174 + virtual int check_vhost(bool try_default_vhost);
175 virtual int playing(SrsSource* source); 175 virtual int playing(SrsSource* source);
176 virtual int do_playing(SrsSource* source, SrsConsumer* consumer, SrsQueueRecvThread* trd); 176 virtual int do_playing(SrsSource* source, SrsConsumer* consumer, SrsQueueRecvThread* trd);
177 virtual int publishing(SrsSource* source); 177 virtual int publishing(SrsSource* source);