winlin

for bug #277, the http server subscribe the reload.

@@ -199,6 +199,13 @@ int SrsHttpServer::initialize() @@ -199,6 +199,13 @@ int SrsHttpServer::initialize()
199 return ret; 199 return ret;
200 } 200 }
201 201
  202 +int SrsHttpServer::on_reload_vhost_http_updated()
  203 +{
  204 + int ret = ERROR_SUCCESS;
  205 + // TODO: FIXME: implements it.
  206 + return ret;
  207 +}
  208 +
202 SrsHttpConn::SrsHttpConn(SrsServer* svr, st_netfd_t fd, SrsHttpServer* m) 209 SrsHttpConn::SrsHttpConn(SrsServer* svr, st_netfd_t fd, SrsHttpServer* m)
203 : SrsConnection(svr, fd) 210 : SrsConnection(svr, fd)
204 { 211 {
@@ -35,6 +35,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -35,6 +35,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 #include <srs_app_st.hpp> 35 #include <srs_app_st.hpp>
36 #include <srs_app_conn.hpp> 36 #include <srs_app_conn.hpp>
37 #include <srs_app_http.hpp> 37 #include <srs_app_http.hpp>
  38 +#include <srs_app_reload.hpp>
38 39
39 class SrsStSocket; 40 class SrsStSocket;
40 class SrsHttpParser; 41 class SrsHttpParser;
@@ -56,7 +57,7 @@ protected: @@ -56,7 +57,7 @@ protected:
56 virtual int serve_flv_stream(ISrsGoHttpResponseWriter* w, SrsHttpMessage* r, std::string fullpath, int offset); 57 virtual int serve_flv_stream(ISrsGoHttpResponseWriter* w, SrsHttpMessage* r, std::string fullpath, int offset);
57 }; 58 };
58 59
59 -class SrsHttpServer 60 +class SrsHttpServer : public ISrsReloadHandler
60 { 61 {
61 public: 62 public:
62 SrsGoHttpServeMux mux; 63 SrsGoHttpServeMux mux;
@@ -65,6 +66,9 @@ public: @@ -65,6 +66,9 @@ public:
65 virtual ~SrsHttpServer(); 66 virtual ~SrsHttpServer();
66 public: 67 public:
67 virtual int initialize(); 68 virtual int initialize();
  69 +// interface ISrsThreadHandler.
  70 +public:
  71 + virtual int on_reload_vhost_http_updated();
68 }; 72 };
69 73
70 class SrsHttpConn : public SrsConnection 74 class SrsHttpConn : public SrsConnection
@@ -1013,22 +1013,6 @@ int SrsServer::on_reload_vhost_removed(std::string /*vhost*/) @@ -1013,22 +1013,6 @@ int SrsServer::on_reload_vhost_removed(std::string /*vhost*/)
1013 return ret; 1013 return ret;
1014 } 1014 }
1015 1015
1016 -int SrsServer::on_reload_vhost_http_updated()  
1017 -{  
1018 - int ret = ERROR_SUCCESS;  
1019 -  
1020 -#ifdef SRS_AUTO_HTTP_SERVER  
1021 - srs_freep(http_stream_mux);  
1022 - http_stream_mux = new SrsHttpServer();  
1023 -  
1024 - if ((ret = http_stream_mux->initialize()) != ERROR_SUCCESS) {  
1025 - return ret;  
1026 - }  
1027 -#endif  
1028 -  
1029 - return ret;  
1030 -}  
1031 -  
1032 int SrsServer::on_reload_http_api_enabled() 1016 int SrsServer::on_reload_http_api_enabled()
1033 { 1017 {
1034 int ret = ERROR_SUCCESS; 1018 int ret = ERROR_SUCCESS;
@@ -236,7 +236,6 @@ public: @@ -236,7 +236,6 @@ public:
236 virtual int on_reload_pid(); 236 virtual int on_reload_pid();
237 virtual int on_reload_vhost_added(std::string vhost); 237 virtual int on_reload_vhost_added(std::string vhost);
238 virtual int on_reload_vhost_removed(std::string vhost); 238 virtual int on_reload_vhost_removed(std::string vhost);
239 - virtual int on_reload_vhost_http_updated();  
240 virtual int on_reload_http_api_enabled(); 239 virtual int on_reload_http_api_enabled();
241 virtual int on_reload_http_api_disabled(); 240 virtual int on_reload_http_api_disabled();
242 virtual int on_reload_http_stream_enabled(); 241 virtual int on_reload_http_stream_enabled();