正在显示
6 个修改的文件
包含
40 行增加
和
2 行删除
| @@ -38,6 +38,7 @@ srs_log_file ./objs/srs.log; | @@ -38,6 +38,7 @@ srs_log_file ./objs/srs.log; | ||
| 38 | # default: 2000 | 38 | # default: 2000 |
| 39 | max_connections 1000; | 39 | max_connections 1000; |
| 40 | # whether start as deamon | 40 | # whether start as deamon |
| 41 | +# @remark: donot support reload. | ||
| 41 | # default: on | 42 | # default: on |
| 42 | daemon on; | 43 | daemon on; |
| 43 | 44 | ||
| @@ -66,7 +67,7 @@ http_api { | @@ -66,7 +67,7 @@ http_api { | ||
| 66 | # user can access the http server pages, generally: | 67 | # user can access the http server pages, generally: |
| 67 | # curl http://192.168.1.170:80/srs.html | 68 | # curl http://192.168.1.170:80/srs.html |
| 68 | # which will show srs version and welcome to srs. | 69 | # which will show srs version and welcome to srs. |
| 69 | -# @remeark, the http embeded stream need to config the vhost, for instance, the __defaultVhost__ | 70 | +# @remark, the http embeded stream need to config the vhost, for instance, the __defaultVhost__ |
| 70 | # need to open the feature http of vhost. | 71 | # need to open the feature http of vhost. |
| 71 | http_stream { | 72 | http_stream { |
| 72 | # whether http streaming service is enabled. | 73 | # whether http streaming service is enabled. |
| @@ -554,7 +554,7 @@ int SrsConfig::reload() | @@ -554,7 +554,7 @@ int SrsConfig::reload() | ||
| 554 | } | 554 | } |
| 555 | 555 | ||
| 556 | // directly supported for reload: | 556 | // directly supported for reload: |
| 557 | - // chunk_size, ff_log_dir | 557 | + // chunk_size, ff_log_dir, max_connections |
| 558 | 558 | ||
| 559 | // merge config: pithy_print | 559 | // merge config: pithy_print |
| 560 | if (!srs_directive_equals(root->get("pithy_print"), old_root->get("pithy_print"))) { | 560 | if (!srs_directive_equals(root->get("pithy_print"), old_root->get("pithy_print"))) { |
| @@ -643,6 +643,17 @@ int SrsConfig::reload() | @@ -643,6 +643,17 @@ int SrsConfig::reload() | ||
| 643 | // merge config: vhost modified. | 643 | // merge config: vhost modified. |
| 644 | srs_trace("vhost %s modified, reload its detail.", vhost.c_str()); | 644 | srs_trace("vhost %s modified, reload its detail.", vhost.c_str()); |
| 645 | if (get_vhost_enabled(new_vhost) && get_vhost_enabled(old_vhost)) { | 645 | if (get_vhost_enabled(new_vhost) && get_vhost_enabled(old_vhost)) { |
| 646 | + // atc, only one per vhost | ||
| 647 | + if (!srs_directive_equals(new_vhost->get("atc"), old_vhost->get("atc"))) { | ||
| 648 | + for (it = subscribes.begin(); it != subscribes.end(); ++it) { | ||
| 649 | + ISrsReloadHandler* subscribe = *it; | ||
| 650 | + if ((ret = subscribe->on_reload_atc(vhost)) != ERROR_SUCCESS) { | ||
| 651 | + srs_error("vhost %s notify subscribes atc failed. ret=%d", vhost.c_str(), ret); | ||
| 652 | + return ret; | ||
| 653 | + } | ||
| 654 | + } | ||
| 655 | + srs_trace("vhost %s reload atc success.", vhost.c_str()); | ||
| 656 | + } | ||
| 646 | // gop_cache, only one per vhost | 657 | // gop_cache, only one per vhost |
| 647 | if (!srs_directive_equals(new_vhost->get("gop_cache"), old_vhost->get("gop_cache"))) { | 658 | if (!srs_directive_equals(new_vhost->get("gop_cache"), old_vhost->get("gop_cache"))) { |
| 648 | for (it = subscribes.begin(); it != subscribes.end(); ++it) { | 659 | for (it = subscribes.begin(); it != subscribes.end(); ++it) { |
| @@ -75,6 +75,11 @@ int ISrsReloadHandler::on_reload_vhost_removed(string /*vhost*/) | @@ -75,6 +75,11 @@ int ISrsReloadHandler::on_reload_vhost_removed(string /*vhost*/) | ||
| 75 | return ERROR_SUCCESS; | 75 | return ERROR_SUCCESS; |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | +int ISrsReloadHandler::on_reload_atc(string /*vhost*/) | ||
| 79 | +{ | ||
| 80 | + return ERROR_SUCCESS; | ||
| 81 | +} | ||
| 82 | + | ||
| 78 | int ISrsReloadHandler::on_reload_gop_cache(string /*vhost*/) | 83 | int ISrsReloadHandler::on_reload_gop_cache(string /*vhost*/) |
| 79 | { | 84 | { |
| 80 | return ERROR_SUCCESS; | 85 | return ERROR_SUCCESS; |
| @@ -49,6 +49,7 @@ public: | @@ -49,6 +49,7 @@ public: | ||
| 49 | virtual int on_reload_pithy_print(); | 49 | virtual int on_reload_pithy_print(); |
| 50 | virtual int on_reload_vhost_added(std::string vhost); | 50 | virtual int on_reload_vhost_added(std::string vhost); |
| 51 | virtual int on_reload_vhost_removed(std::string vhost); | 51 | virtual int on_reload_vhost_removed(std::string vhost); |
| 52 | + virtual int on_reload_atc(std::string vhost); | ||
| 52 | virtual int on_reload_gop_cache(std::string vhost); | 53 | virtual int on_reload_gop_cache(std::string vhost); |
| 53 | virtual int on_reload_queue_length(std::string vhost); | 54 | virtual int on_reload_queue_length(std::string vhost); |
| 54 | virtual int on_reload_forward(std::string vhost); | 55 | virtual int on_reload_forward(std::string vhost); |
| @@ -484,6 +484,25 @@ SrsSource::~SrsSource() | @@ -484,6 +484,25 @@ SrsSource::~SrsSource() | ||
| 484 | srs_freep(req); | 484 | srs_freep(req); |
| 485 | } | 485 | } |
| 486 | 486 | ||
| 487 | +int SrsSource::on_reload_atc(string vhost) | ||
| 488 | +{ | ||
| 489 | + int ret = ERROR_SUCCESS; | ||
| 490 | + | ||
| 491 | + if (req->vhost != vhost) { | ||
| 492 | + return ret; | ||
| 493 | + } | ||
| 494 | + | ||
| 495 | + // atc changed. | ||
| 496 | + bool enabled_atc = _srs_config->get_atc(vhost); | ||
| 497 | + | ||
| 498 | + srs_warn("vhost %s atc changed to %d, connected client may corrupt.", | ||
| 499 | + vhost.c_str(), enabled_atc); | ||
| 500 | + | ||
| 501 | + gop_cache->clear(); | ||
| 502 | + | ||
| 503 | + return ret; | ||
| 504 | +} | ||
| 505 | + | ||
| 487 | int SrsSource::on_reload_gop_cache(string vhost) | 506 | int SrsSource::on_reload_gop_cache(string vhost) |
| 488 | { | 507 | { |
| 489 | int ret = ERROR_SUCCESS; | 508 | int ret = ERROR_SUCCESS; |
| @@ -266,6 +266,7 @@ public: | @@ -266,6 +266,7 @@ 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); | ||
| 269 | virtual int on_reload_gop_cache(std::string vhost); | 270 | virtual int on_reload_gop_cache(std::string vhost); |
| 270 | virtual int on_reload_queue_length(std::string vhost); | 271 | virtual int on_reload_queue_length(std::string vhost); |
| 271 | virtual int on_reload_forward(std::string vhost); | 272 | virtual int on_reload_forward(std::string vhost); |
-
请 注册 或 登录 后发表评论