winlin

refine reload, rename some vhost specified to add vhost prefix

@@ -793,7 +793,7 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root) @@ -793,7 +793,7 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
793 if (!srs_directive_equals(new_vhost->get("atc"), old_vhost->get("atc"))) { 793 if (!srs_directive_equals(new_vhost->get("atc"), old_vhost->get("atc"))) {
794 for (it = subscribes.begin(); it != subscribes.end(); ++it) { 794 for (it = subscribes.begin(); it != subscribes.end(); ++it) {
795 ISrsReloadHandler* subscribe = *it; 795 ISrsReloadHandler* subscribe = *it;
796 - if ((ret = subscribe->on_reload_atc(vhost)) != ERROR_SUCCESS) { 796 + if ((ret = subscribe->on_reload_vhost_atc(vhost)) != ERROR_SUCCESS) {
797 srs_error("vhost %s notify subscribes atc failed. ret=%d", vhost.c_str(), ret); 797 srs_error("vhost %s notify subscribes atc failed. ret=%d", vhost.c_str(), ret);
798 return ret; 798 return ret;
799 } 799 }
@@ -804,7 +804,7 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root) @@ -804,7 +804,7 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
804 if (!srs_directive_equals(new_vhost->get("gop_cache"), old_vhost->get("gop_cache"))) { 804 if (!srs_directive_equals(new_vhost->get("gop_cache"), old_vhost->get("gop_cache"))) {
805 for (it = subscribes.begin(); it != subscribes.end(); ++it) { 805 for (it = subscribes.begin(); it != subscribes.end(); ++it) {
806 ISrsReloadHandler* subscribe = *it; 806 ISrsReloadHandler* subscribe = *it;
807 - if ((ret = subscribe->on_reload_gop_cache(vhost)) != ERROR_SUCCESS) { 807 + if ((ret = subscribe->on_reload_vhost_gop_cache(vhost)) != ERROR_SUCCESS) {
808 srs_error("vhost %s notify subscribes gop_cache failed. ret=%d", vhost.c_str(), ret); 808 srs_error("vhost %s notify subscribes gop_cache failed. ret=%d", vhost.c_str(), ret);
809 return ret; 809 return ret;
810 } 810 }
@@ -815,7 +815,7 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root) @@ -815,7 +815,7 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
815 if (!srs_directive_equals(new_vhost->get("queue_length"), old_vhost->get("queue_length"))) { 815 if (!srs_directive_equals(new_vhost->get("queue_length"), old_vhost->get("queue_length"))) {
816 for (it = subscribes.begin(); it != subscribes.end(); ++it) { 816 for (it = subscribes.begin(); it != subscribes.end(); ++it) {
817 ISrsReloadHandler* subscribe = *it; 817 ISrsReloadHandler* subscribe = *it;
818 - if ((ret = subscribe->on_reload_queue_length(vhost)) != ERROR_SUCCESS) { 818 + if ((ret = subscribe->on_reload_vhost_queue_length(vhost)) != ERROR_SUCCESS) {
819 srs_error("vhost %s notify subscribes queue_length failed. ret=%d", vhost.c_str(), ret); 819 srs_error("vhost %s notify subscribes queue_length failed. ret=%d", vhost.c_str(), ret);
820 return ret; 820 return ret;
821 } 821 }
@@ -826,7 +826,7 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root) @@ -826,7 +826,7 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
826 if (!srs_directive_equals(new_vhost->get("forward"), old_vhost->get("forward"))) { 826 if (!srs_directive_equals(new_vhost->get("forward"), old_vhost->get("forward"))) {
827 for (it = subscribes.begin(); it != subscribes.end(); ++it) { 827 for (it = subscribes.begin(); it != subscribes.end(); ++it) {
828 ISrsReloadHandler* subscribe = *it; 828 ISrsReloadHandler* subscribe = *it;
829 - if ((ret = subscribe->on_reload_forward(vhost)) != ERROR_SUCCESS) { 829 + if ((ret = subscribe->on_reload_vhost_forward(vhost)) != ERROR_SUCCESS) {
830 srs_error("vhost %s notify subscribes forward failed. ret=%d", vhost.c_str(), ret); 830 srs_error("vhost %s notify subscribes forward failed. ret=%d", vhost.c_str(), ret);
831 return ret; 831 return ret;
832 } 832 }
@@ -837,7 +837,7 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root) @@ -837,7 +837,7 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
837 if (!srs_directive_equals(new_vhost->get("hls"), old_vhost->get("hls"))) { 837 if (!srs_directive_equals(new_vhost->get("hls"), old_vhost->get("hls"))) {
838 for (it = subscribes.begin(); it != subscribes.end(); ++it) { 838 for (it = subscribes.begin(); it != subscribes.end(); ++it) {
839 ISrsReloadHandler* subscribe = *it; 839 ISrsReloadHandler* subscribe = *it;
840 - if ((ret = subscribe->on_reload_hls(vhost)) != ERROR_SUCCESS) { 840 + if ((ret = subscribe->on_reload_vhost_hls(vhost)) != ERROR_SUCCESS) {
841 srs_error("vhost %s notify subscribes hls failed. ret=%d", vhost.c_str(), ret); 841 srs_error("vhost %s notify subscribes hls failed. ret=%d", vhost.c_str(), ret);
842 return ret; 842 return ret;
843 } 843 }
@@ -945,7 +945,7 @@ int SrsConfig::reload_transcode(SrsConfDirective* new_vhost, SrsConfDirective* o @@ -945,7 +945,7 @@ int SrsConfig::reload_transcode(SrsConfDirective* new_vhost, SrsConfDirective* o
945 if (changed) { 945 if (changed) {
946 for (it = subscribes.begin(); it != subscribes.end(); ++it) { 946 for (it = subscribes.begin(); it != subscribes.end(); ++it) {
947 ISrsReloadHandler* subscribe = *it; 947 ISrsReloadHandler* subscribe = *it;
948 - if ((ret = subscribe->on_reload_transcode(vhost)) != ERROR_SUCCESS) { 948 + if ((ret = subscribe->on_reload_vhost_transcode(vhost)) != ERROR_SUCCESS) {
949 srs_error("vhost %s notify subscribes transcode failed. ret=%d", vhost.c_str(), ret); 949 srs_error("vhost %s notify subscribes transcode failed. ret=%d", vhost.c_str(), ret);
950 return ret; 950 return ret;
951 } 951 }
@@ -105,32 +105,32 @@ int ISrsReloadHandler::on_reload_vhost_removed(string /*vhost*/) @@ -105,32 +105,32 @@ int ISrsReloadHandler::on_reload_vhost_removed(string /*vhost*/)
105 return ERROR_SUCCESS; 105 return ERROR_SUCCESS;
106 } 106 }
107 107
108 -int ISrsReloadHandler::on_reload_atc(string /*vhost*/) 108 +int ISrsReloadHandler::on_reload_vhost_atc(string /*vhost*/)
109 { 109 {
110 return ERROR_SUCCESS; 110 return ERROR_SUCCESS;
111 } 111 }
112 112
113 -int ISrsReloadHandler::on_reload_gop_cache(string /*vhost*/) 113 +int ISrsReloadHandler::on_reload_vhost_gop_cache(string /*vhost*/)
114 { 114 {
115 return ERROR_SUCCESS; 115 return ERROR_SUCCESS;
116 } 116 }
117 117
118 -int ISrsReloadHandler::on_reload_queue_length(string /*vhost*/) 118 +int ISrsReloadHandler::on_reload_vhost_queue_length(string /*vhost*/)
119 { 119 {
120 return ERROR_SUCCESS; 120 return ERROR_SUCCESS;
121 } 121 }
122 122
123 -int ISrsReloadHandler::on_reload_forward(string /*vhost*/) 123 +int ISrsReloadHandler::on_reload_vhost_forward(string /*vhost*/)
124 { 124 {
125 return ERROR_SUCCESS; 125 return ERROR_SUCCESS;
126 } 126 }
127 127
128 -int ISrsReloadHandler::on_reload_hls(string /*vhost*/) 128 +int ISrsReloadHandler::on_reload_vhost_hls(string /*vhost*/)
129 { 129 {
130 return ERROR_SUCCESS; 130 return ERROR_SUCCESS;
131 } 131 }
132 132
133 -int ISrsReloadHandler::on_reload_transcode(string /*vhost*/) 133 +int ISrsReloadHandler::on_reload_vhost_transcode(string /*vhost*/)
134 { 134 {
135 return ERROR_SUCCESS; 135 return ERROR_SUCCESS;
136 } 136 }
@@ -55,12 +55,12 @@ public: @@ -55,12 +55,12 @@ public:
55 virtual int on_reload_vhost_http_updated(); 55 virtual int on_reload_vhost_http_updated();
56 virtual int on_reload_vhost_added(std::string vhost); 56 virtual int on_reload_vhost_added(std::string vhost);
57 virtual int on_reload_vhost_removed(std::string vhost); 57 virtual int on_reload_vhost_removed(std::string vhost);
58 - virtual int on_reload_atc(std::string vhost);  
59 - virtual int on_reload_gop_cache(std::string vhost);  
60 - virtual int on_reload_queue_length(std::string vhost);  
61 - virtual int on_reload_forward(std::string vhost);  
62 - virtual int on_reload_hls(std::string vhost);  
63 - virtual int on_reload_transcode(std::string vhost); 58 + virtual int on_reload_vhost_atc(std::string vhost);
  59 + virtual int on_reload_vhost_gop_cache(std::string vhost);
  60 + virtual int on_reload_vhost_queue_length(std::string vhost);
  61 + virtual int on_reload_vhost_forward(std::string vhost);
  62 + virtual int on_reload_vhost_hls(std::string vhost);
  63 + virtual int on_reload_vhost_transcode(std::string vhost);
64 virtual int on_reload_ingest_removed(std::string vhost, std::string ingest_id); 64 virtual int on_reload_ingest_removed(std::string vhost, std::string ingest_id);
65 virtual int on_reload_ingest_added(std::string vhost, std::string ingest_id); 65 virtual int on_reload_ingest_added(std::string vhost, std::string ingest_id);
66 virtual int on_reload_ingest_updated(std::string vhost, std::string ingest_id); 66 virtual int on_reload_ingest_updated(std::string vhost, std::string ingest_id);
@@ -484,7 +484,7 @@ SrsSource::~SrsSource() @@ -484,7 +484,7 @@ SrsSource::~SrsSource()
484 srs_freep(req); 484 srs_freep(req);
485 } 485 }
486 486
487 -int SrsSource::on_reload_atc(string vhost) 487 +int SrsSource::on_reload_vhost_atc(string vhost)
488 { 488 {
489 int ret = ERROR_SUCCESS; 489 int ret = ERROR_SUCCESS;
490 490
@@ -503,7 +503,7 @@ int SrsSource::on_reload_atc(string vhost) @@ -503,7 +503,7 @@ int SrsSource::on_reload_atc(string vhost)
503 return ret; 503 return ret;
504 } 504 }
505 505
506 -int SrsSource::on_reload_gop_cache(string vhost) 506 +int SrsSource::on_reload_vhost_gop_cache(string vhost)
507 { 507 {
508 int ret = ERROR_SUCCESS; 508 int ret = ERROR_SUCCESS;
509 509
@@ -522,7 +522,7 @@ int SrsSource::on_reload_gop_cache(string vhost) @@ -522,7 +522,7 @@ int SrsSource::on_reload_gop_cache(string vhost)
522 return ret; 522 return ret;
523 } 523 }
524 524
525 -int SrsSource::on_reload_queue_length(string vhost) 525 +int SrsSource::on_reload_vhost_queue_length(string vhost)
526 { 526 {
527 int ret = ERROR_SUCCESS; 527 int ret = ERROR_SUCCESS;
528 528
@@ -557,7 +557,7 @@ int SrsSource::on_reload_queue_length(string vhost) @@ -557,7 +557,7 @@ int SrsSource::on_reload_queue_length(string vhost)
557 return ret; 557 return ret;
558 } 558 }
559 559
560 -int SrsSource::on_reload_forward(string vhost) 560 +int SrsSource::on_reload_vhost_forward(string vhost)
561 { 561 {
562 int ret = ERROR_SUCCESS; 562 int ret = ERROR_SUCCESS;
563 563
@@ -577,7 +577,7 @@ int SrsSource::on_reload_forward(string vhost) @@ -577,7 +577,7 @@ int SrsSource::on_reload_forward(string vhost)
577 return ret; 577 return ret;
578 } 578 }
579 579
580 -int SrsSource::on_reload_hls(string vhost) 580 +int SrsSource::on_reload_vhost_hls(string vhost)
581 { 581 {
582 int ret = ERROR_SUCCESS; 582 int ret = ERROR_SUCCESS;
583 583
@@ -597,7 +597,7 @@ int SrsSource::on_reload_hls(string vhost) @@ -597,7 +597,7 @@ int SrsSource::on_reload_hls(string vhost)
597 return ret; 597 return ret;
598 } 598 }
599 599
600 -int SrsSource::on_reload_transcode(string vhost) 600 +int SrsSource::on_reload_vhost_transcode(string vhost)
601 { 601 {
602 int ret = ERROR_SUCCESS; 602 int ret = ERROR_SUCCESS;
603 603
@@ -266,12 +266,12 @@ public: @@ -266,12 +266,12 @@ public:
266 virtual ~SrsSource(); 266 virtual ~SrsSource();
267 // interface ISrsReloadHandler 267 // interface ISrsReloadHandler
268 public: 268 public:
269 - virtual int on_reload_atc(std::string vhost);  
270 - virtual int on_reload_gop_cache(std::string vhost);  
271 - virtual int on_reload_queue_length(std::string vhost);  
272 - virtual int on_reload_forward(std::string vhost);  
273 - virtual int on_reload_hls(std::string vhost);  
274 - virtual int on_reload_transcode(std::string vhost); 269 + virtual int on_reload_vhost_atc(std::string vhost);
  270 + virtual int on_reload_vhost_gop_cache(std::string vhost);
  271 + virtual int on_reload_vhost_queue_length(std::string vhost);
  272 + virtual int on_reload_vhost_forward(std::string vhost);
  273 + virtual int on_reload_vhost_hls(std::string vhost);
  274 + virtual int on_reload_vhost_transcode(std::string vhost);
275 public: 275 public:
276 // for the SrsForwarder to callback to request the sequence headers. 276 // for the SrsForwarder to callback to request the sequence headers.
277 virtual int on_forwarder_start(SrsForwarder* forwarder); 277 virtual int on_forwarder_start(SrsForwarder* forwarder);