From c4302b9b619387c0147da4a564a84edcf57e907b Mon Sep 17 00:00:00 2001 From: winlin Date: Sun, 18 Jan 2015 17:17:07 +0800 Subject: [PATCH] for bug #277, the http server subscribe the reload. --- trunk/src/app/srs_app_http_conn.cpp | 7 +++++++ trunk/src/app/srs_app_http_conn.hpp | 6 +++++- trunk/src/app/srs_app_server.cpp | 16 ---------------- trunk/src/app/srs_app_server.hpp | 1 - 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/trunk/src/app/srs_app_http_conn.cpp b/trunk/src/app/srs_app_http_conn.cpp index 65af7897f..3d630b913 100644 --- a/trunk/src/app/srs_app_http_conn.cpp +++ b/trunk/src/app/srs_app_http_conn.cpp @@ -199,6 +199,13 @@ int SrsHttpServer::initialize() return ret; } +int SrsHttpServer::on_reload_vhost_http_updated() +{ + int ret = ERROR_SUCCESS; + // TODO: FIXME: implements it. + return ret; +} + SrsHttpConn::SrsHttpConn(SrsServer* svr, st_netfd_t fd, SrsHttpServer* m) : SrsConnection(svr, fd) { diff --git a/trunk/src/app/srs_app_http_conn.hpp b/trunk/src/app/srs_app_http_conn.hpp index cf79f1beb..0f20bee40 100644 --- a/trunk/src/app/srs_app_http_conn.hpp +++ b/trunk/src/app/srs_app_http_conn.hpp @@ -35,6 +35,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include +#include class SrsStSocket; class SrsHttpParser; @@ -56,7 +57,7 @@ protected: virtual int serve_flv_stream(ISrsGoHttpResponseWriter* w, SrsHttpMessage* r, std::string fullpath, int offset); }; -class SrsHttpServer +class SrsHttpServer : public ISrsReloadHandler { public: SrsGoHttpServeMux mux; @@ -65,6 +66,9 @@ public: virtual ~SrsHttpServer(); public: virtual int initialize(); +// interface ISrsThreadHandler. +public: + virtual int on_reload_vhost_http_updated(); }; class SrsHttpConn : public SrsConnection diff --git a/trunk/src/app/srs_app_server.cpp b/trunk/src/app/srs_app_server.cpp index c754fc47f..87ad4d596 100644 --- a/trunk/src/app/srs_app_server.cpp +++ b/trunk/src/app/srs_app_server.cpp @@ -1013,22 +1013,6 @@ int SrsServer::on_reload_vhost_removed(std::string /*vhost*/) return ret; } -int SrsServer::on_reload_vhost_http_updated() -{ - int ret = ERROR_SUCCESS; - -#ifdef SRS_AUTO_HTTP_SERVER - srs_freep(http_stream_mux); - http_stream_mux = new SrsHttpServer(); - - if ((ret = http_stream_mux->initialize()) != ERROR_SUCCESS) { - return ret; - } -#endif - - return ret; -} - int SrsServer::on_reload_http_api_enabled() { int ret = ERROR_SUCCESS; diff --git a/trunk/src/app/srs_app_server.hpp b/trunk/src/app/srs_app_server.hpp index 1380d9a97..d88b1f558 100644 --- a/trunk/src/app/srs_app_server.hpp +++ b/trunk/src/app/srs_app_server.hpp @@ -236,7 +236,6 @@ public: virtual int on_reload_pid(); virtual int on_reload_vhost_added(std::string vhost); virtual int on_reload_vhost_removed(std::string vhost); - virtual int on_reload_vhost_http_updated(); virtual int on_reload_http_api_enabled(); virtual int on_reload_http_api_disabled(); virtual int on_reload_http_stream_enabled();