Skip to content

Commit 4d4ccf6

Browse files
committed
Threads: Remove reload for streams
1 parent 2a10f97 commit 4d4ccf6

18 files changed

+17
-418
lines changed

trunk/src/app/srs_app_caster_flv.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,6 @@ srs_error_t SrsDynamicHttpConn::do_proxy(ISrsHttpResponseReader* rr, SrsFlvDecod
258258
return err;
259259
}
260260

261-
srs_error_t SrsDynamicHttpConn::on_reload_http_stream_crossdomain()
262-
{
263-
bool v = _srs_config->get_http_stream_crossdomain();
264-
return conn->set_crossdomain_enabled(v);
265-
}
266-
267261
srs_error_t SrsDynamicHttpConn::on_start()
268262
{
269263
return srs_success;

trunk/src/app/srs_app_caster_flv.hpp

-4
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@ class SrsDynamicHttpConn : virtual public ISrsStartableConneciton, virtual publi
9494
virtual srs_error_t proxy(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, std::string o);
9595
private:
9696
virtual srs_error_t do_proxy(ISrsHttpResponseReader* rr, SrsFlvDecoder* dec);
97-
// Extract APIs from SrsTcpConnection.
98-
// Interface ISrsReloadHandler
99-
public:
100-
virtual srs_error_t on_reload_http_stream_crossdomain();
10197
// Interface ISrsHttpConnOwner.
10298
public:
10399
virtual srs_error_t on_start();

trunk/src/app/srs_app_config.cpp

+5-112
Original file line numberDiff line numberDiff line change
@@ -1654,27 +1654,13 @@ srs_error_t SrsConfig::reload_conf(SrsConfig* conf)
16541654
// bandcheck, http_hooks, heartbeat,
16551655
// security
16561656

1657-
// merge config: listen
1658-
if (!srs_directive_equals(root->get("listen"), old_root->get("listen"))) {
1659-
if ((err = do_reload_listen()) != srs_success) {
1660-
return srs_error_wrap(err, "listen");
1661-
}
1662-
}
1663-
16641657
// merge config: pid
16651658
if (!srs_directive_equals(root->get("pid"), old_root->get("pid"))) {
16661659
if ((err = do_reload_pid()) != srs_success) {
16671660
return srs_error_wrap(err, "pid");;
16681661
}
16691662
}
16701663

1671-
// merge config: max_connections
1672-
if (!srs_directive_equals(root->get("max_connections"), old_root->get("max_connections"))) {
1673-
if ((err = do_reload_max_connections()) != srs_success) {
1674-
return srs_error_wrap(err, "max connections");;
1675-
}
1676-
}
1677-
16781664
// merge config: pithy_print_ms
16791665
if (!srs_directive_equals(root->get("pithy_print_ms"), old_root->get("pithy_print_ms"))) {
16801666
if ((err = do_reload_pithy_print_ms()) != srs_success) {
@@ -1686,15 +1672,10 @@ srs_error_t SrsConfig::reload_conf(SrsConfig* conf)
16861672
if ((err = reload_http_api(old_root)) != srs_success) {
16871673
return srs_error_wrap(err, "http api");;
16881674
}
1689-
1690-
// merge config: http_stream
1691-
if ((err = reload_http_stream(old_root)) != srs_success) {
1692-
return srs_error_wrap(err, "http steram");;
1693-
}
16941675

1695-
// Merge config: rtc_server
1696-
if ((err = reload_rtc_server(old_root)) != srs_success) {
1697-
return srs_error_wrap(err, "http steram");;
1676+
// merge config: streams
1677+
if ((err = reload_streams(old_root)) != srs_success) {
1678+
return srs_error_wrap(err, "streams");;
16981679
}
16991680

17001681
// TODO: FIXME: support reload stream_caster.
@@ -1785,17 +1766,10 @@ srs_error_t SrsConfig::reload_http_api(SrsConfDirective* old_root)
17851766
return err;
17861767
}
17871768

1788-
srs_error_t SrsConfig::reload_http_stream(SrsConfDirective* old_root)
1789-
{
1790-
srs_error_t err = srs_success;
1791-
// TODO: FIXME: We never support reload HTTP stream.
1792-
return err;
1793-
}
1794-
1795-
srs_error_t SrsConfig::reload_rtc_server(SrsConfDirective* old_root)
1769+
srs_error_t SrsConfig::reload_streams(SrsConfDirective* old_root)
17961770
{
17971771
srs_error_t err = srs_success;
1798-
// TODO: FIXME: Do not support reloading RTC Server.
1772+
// TODO: FIXME: We never support reload streams.
17991773
return err;
18001774
}
18011775

@@ -2901,31 +2875,6 @@ srs_error_t SrsConfig::raw_to_json(SrsJsonObject* obj)
29012875
return err;
29022876
}
29032877

2904-
srs_error_t SrsConfig::raw_set_listen(const vector<string>& eps, bool& applied)
2905-
{
2906-
srs_error_t err = srs_success;
2907-
2908-
applied = false;
2909-
2910-
SrsConfDirective* conf = root->get("listen");
2911-
2912-
// nothing changed, ignore.
2913-
if (srs_vector_actual_equals(conf->args, eps)) {
2914-
return err;
2915-
}
2916-
2917-
// changed, apply and reload.
2918-
conf->args = eps;
2919-
2920-
if ((err = do_reload_listen()) != srs_success) {
2921-
return srs_error_wrap(err, "reload listen");
2922-
}
2923-
2924-
applied = true;
2925-
2926-
return err;
2927-
}
2928-
29292878
srs_error_t SrsConfig::raw_set_pid(string pid, bool& applied)
29302879
{
29312880
srs_error_t err = srs_success;
@@ -2994,30 +2943,6 @@ srs_error_t SrsConfig::raw_set_ff_log_dir(string ff_log_dir, bool& applied)
29942943
return err;
29952944
}
29962945

2997-
srs_error_t SrsConfig::raw_set_max_connections(string max_connections, bool& applied)
2998-
{
2999-
srs_error_t err = srs_success;
3000-
3001-
applied = false;
3002-
3003-
SrsConfDirective* conf = root->get_or_create("max_connections");
3004-
3005-
if (conf->arg0() == max_connections) {
3006-
return err;
3007-
}
3008-
3009-
conf->args.clear();
3010-
conf->args.push_back(max_connections);
3011-
3012-
if ((err = do_reload_max_connections()) != srs_success) {
3013-
return srs_error_wrap(err, "reload max connection");
3014-
}
3015-
3016-
applied = true;
3017-
3018-
return err;
3019-
}
3020-
30212946
srs_error_t SrsConfig::raw_set_pithy_print_ms(string pithy_print_ms, bool& applied)
30222947
{
30232948
srs_error_t err = srs_success;
@@ -3185,22 +3110,6 @@ srs_error_t SrsConfig::raw_disable_dvr(string vhost, string stream, bool& applie
31853110
}
31863111
// LCOV_EXCL_STOP
31873112

3188-
srs_error_t SrsConfig::do_reload_listen()
3189-
{
3190-
srs_error_t err = srs_success;
3191-
3192-
vector<ISrsReloadHandler*>::iterator it;
3193-
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
3194-
ISrsReloadHandler* subscribe = *it;
3195-
if ((err = subscribe->on_reload_listen()) != srs_success) {
3196-
return srs_error_wrap(err, "notify subscribes reload listen failed");
3197-
}
3198-
}
3199-
srs_trace("reload listen success.");
3200-
3201-
return err;
3202-
}
3203-
32043113
srs_error_t SrsConfig::do_reload_pid()
32053114
{
32063115
srs_error_t err = srs_success;
@@ -3217,22 +3126,6 @@ srs_error_t SrsConfig::do_reload_pid()
32173126
return err;
32183127
}
32193128

3220-
srs_error_t SrsConfig::do_reload_max_connections()
3221-
{
3222-
srs_error_t err = srs_success;
3223-
3224-
vector<ISrsReloadHandler*>::iterator it;
3225-
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
3226-
ISrsReloadHandler* subscribe = *it;
3227-
if ((err = subscribe->on_reload_max_conns()) != srs_success) {
3228-
return srs_error_wrap(err, "notify subscribes reload max_connections failed");
3229-
}
3230-
}
3231-
srs_trace("reload max_connections success.");
3232-
3233-
return err;
3234-
}
3235-
32363129
srs_error_t SrsConfig::do_reload_pithy_print_ms()
32373130
{
32383131
srs_error_t err = srs_success;

trunk/src/app/srs_app_config.hpp

+2-11
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,8 @@ class SrsConfig
326326
private:
327327
// Reload the http_api section of config.
328328
virtual srs_error_t reload_http_api(SrsConfDirective* old_root);
329-
// Reload the http_stream section of config.
330-
// TODO: FIXME: rename to http_server.
331-
virtual srs_error_t reload_http_stream(SrsConfDirective* old_root);
332-
// Reload the rtc_server section of config.
333-
virtual srs_error_t reload_rtc_server(SrsConfDirective* old_root);
329+
// Reload the streams for hybrids.
330+
virtual srs_error_t reload_streams(SrsConfDirective* old_root);
334331
// Reload the transcode section of vhost of config.
335332
virtual srs_error_t reload_transcode(SrsConfDirective* new_vhost, SrsConfDirective* old_vhost);
336333
// Reload the ingest section of vhost of config.
@@ -355,16 +352,12 @@ class SrsConfig
355352
virtual srs_error_t vhost_to_json(SrsConfDirective* vhost, SrsJsonObject* obj);
356353
// Dumps the http_api sections to json for raw api info.
357354
virtual srs_error_t raw_to_json(SrsJsonObject* obj);
358-
// RAW set the global listen.
359-
virtual srs_error_t raw_set_listen(const std::vector<std::string>& eps, bool& applied);
360355
// RAW set the global pid.
361356
virtual srs_error_t raw_set_pid(std::string pid, bool& applied);
362357
// RAW set the global chunk size.
363358
virtual srs_error_t raw_set_chunk_size(std::string chunk_size, bool& applied);
364359
// RAW set the global ffmpeg log dir.
365360
virtual srs_error_t raw_set_ff_log_dir(std::string ff_log_dir, bool& applied);
366-
// RAW set the global max connections of srs.
367-
virtual srs_error_t raw_set_max_connections(std::string max_connections, bool& applied);
368361
// RAW set the global pithy print interval in ms.
369362
virtual srs_error_t raw_set_pithy_print_ms(std::string pithy_print_ms, bool& applied);
370363
// RAW create the new vhost.
@@ -382,9 +375,7 @@ class SrsConfig
382375
// RAW disable the dvr of stream of vhost.
383376
virtual srs_error_t raw_disable_dvr(std::string vhost, std::string stream, bool& applied);
384377
private:
385-
virtual srs_error_t do_reload_listen();
386378
virtual srs_error_t do_reload_pid();
387-
virtual srs_error_t do_reload_max_connections();
388379
virtual srs_error_t do_reload_pithy_print_ms();
389380
virtual srs_error_t do_reload_vhost_added(std::string vhost);
390381
virtual srs_error_t do_reload_vhost_removed(std::string vhost);

trunk/src/app/srs_app_http_api.cpp

+3-37
Original file line numberDiff line numberDiff line change
@@ -993,14 +993,12 @@ srs_error_t SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage*
993993
// @data the extra data for scope.
994994
// possible updates:
995995
// @scope @value value-description
996-
// listen 1935,1936 the port list.
997996
// pid ./objs/srs.pid the pid file of srs.
998997
// chunk_size 60000 the global RTMP chunk_size.
999998
// ff_log_dir ./objs the dir for ffmpeg log.
1000999
// srs_log_tank file the tank to log, file or console.
10011000
// srs_log_level trace the level of log, verbose, info, trace, warn, error.
10021001
// srs_log_file ./objs/srs.log the log file when tank is file.
1003-
// max_connections 1000 the max connections of srs.
10041002
// utc_time false whether enable utc time.
10051003
// pithy_print_ms 10000 the pithy print interval in ms.
10061004
// vhost specified updates:
@@ -1021,38 +1019,17 @@ srs_error_t SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage*
10211019
if (scope.empty()) {
10221020
return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_NOT_ALLOWED);
10231021
}
1024-
if (scope != "listen" && scope != "pid" && scope != "chunk_size"
1022+
if (scope != "pid" && scope != "chunk_size"
10251023
&& scope != "ff_log_dir" && scope != "srs_log_tank" && scope != "srs_log_level"
1026-
&& scope != "srs_log_file" && scope != "max_connections" && scope != "utc_time"
1024+
&& scope != "srs_log_file" && scope != "utc_time"
10271025
&& scope != "pithy_print_ms" && scope != "vhost" && scope != "dvr"
10281026
) {
10291027
return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_NOT_ALLOWED);
10301028
}
10311029

10321030
bool applied = false;
10331031
string extra = "";
1034-
if (scope == "listen") {
1035-
vector<string> eps = srs_string_split(value, ",");
1036-
1037-
bool invalid = eps.empty();
1038-
for (int i = 0; i < (int)eps.size(); i++) {
1039-
string ep = eps.at(i);
1040-
int port = ::atoi(ep.c_str());
1041-
if (port <= 2 || port >= 65535) {
1042-
invalid = true;
1043-
break;
1044-
}
1045-
}
1046-
if (invalid) {
1047-
return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_PARAMS);
1048-
}
1049-
1050-
if ((err = _srs_config->raw_set_listen(eps, applied)) != srs_success) {
1051-
int code = srs_error_code(err);
1052-
srs_error_reset(err);
1053-
return srs_api_response_code(w, r, code);
1054-
}
1055-
} else if (scope == "pid") {
1032+
if (scope == "pid") {
10561033
if (value.empty() || !srs_string_starts_with(value, "./", "/tmp/", "/var/") || !srs_string_ends_with(value, ".pid")) {
10571034
return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_PARAMS);
10581035
}
@@ -1083,17 +1060,6 @@ srs_error_t SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage*
10831060
srs_error_reset(err);
10841061
return srs_api_response_code(w, r, code);
10851062
}
1086-
} else if (scope == "max_connections") {
1087-
int mcv = ::atoi(value.c_str());
1088-
if (mcv < 10 || mcv > 65535 || !srs_is_digit_number(value)) {
1089-
return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_PARAMS);
1090-
}
1091-
1092-
if ((err = _srs_config->raw_set_max_connections(value, applied)) != srs_success) {
1093-
int code = srs_error_code(err);
1094-
srs_error_reset(err);
1095-
return srs_api_response_code(w, r, code);
1096-
}
10971063
} else if (scope == "pithy_print_ms") {
10981064
int ppmv = ::atoi(value.c_str());
10991065
if (ppmv < 100 || ppmv > 300000 || !srs_is_digit_number(value)) {

trunk/src/app/srs_app_http_conn.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,6 @@ srs_error_t SrsResponseOnlyHttpConn::pop_message(ISrsHttpMessage** preq)
366366
return err;
367367
}
368368

369-
srs_error_t SrsResponseOnlyHttpConn::on_reload_http_stream_crossdomain()
370-
{
371-
bool v = _srs_config->get_http_stream_crossdomain();
372-
return conn->set_crossdomain_enabled(v);
373-
}
374-
375369
srs_error_t SrsResponseOnlyHttpConn::on_start()
376370
{
377371
srs_error_t err = srs_success;

trunk/src/app/srs_app_http_conn.hpp

-3
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,6 @@ class SrsResponseOnlyHttpConn : virtual public ISrsStartableConneciton, virtual
162162
// @see https://github.com/ossrs/srs/issues/636#issuecomment-298208427
163163
// @remark Should only used in HTTP-FLV streaming connection.
164164
virtual srs_error_t pop_message(ISrsHttpMessage** preq);
165-
// Interface ISrsReloadHandler
166-
public:
167-
virtual srs_error_t on_reload_http_stream_crossdomain();
168165
// Interface ISrsHttpConnOwner.
169166
public:
170167
virtual srs_error_t on_start();

trunk/src/app/srs_app_reload.cpp

-25
Original file line numberDiff line numberDiff line change
@@ -85,31 +85,6 @@ srs_error_t ISrsReloadHandler::on_reload_http_api_raw_api()
8585
return srs_success;
8686
}
8787

88-
srs_error_t ISrsReloadHandler::on_reload_http_stream_enabled()
89-
{
90-
return srs_success;
91-
}
92-
93-
srs_error_t ISrsReloadHandler::on_reload_http_stream_disabled()
94-
{
95-
return srs_success;
96-
}
97-
98-
srs_error_t ISrsReloadHandler::on_reload_http_stream_updated()
99-
{
100-
return srs_success;
101-
}
102-
103-
srs_error_t ISrsReloadHandler::on_reload_http_stream_crossdomain()
104-
{
105-
return srs_success;
106-
}
107-
108-
srs_error_t ISrsReloadHandler::on_reload_rtc_server()
109-
{
110-
return srs_success;
111-
}
112-
11388
srs_error_t ISrsReloadHandler::on_reload_vhost_http_updated()
11489
{
11590
return srs_success;

trunk/src/app/srs_app_reload.hpp

-5
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@ class ISrsReloadHandler
4949
virtual srs_error_t on_reload_https_api_disabled();
5050
virtual srs_error_t on_reload_http_api_crossdomain();
5151
virtual srs_error_t on_reload_http_api_raw_api();
52-
virtual srs_error_t on_reload_http_stream_enabled();
53-
virtual srs_error_t on_reload_http_stream_disabled();
54-
virtual srs_error_t on_reload_http_stream_updated();
55-
virtual srs_error_t on_reload_http_stream_crossdomain();
56-
virtual srs_error_t on_reload_rtc_server();
5752
public:
5853
// TODO: FIXME: should rename to http_static
5954
virtual srs_error_t on_reload_vhost_http_updated();

0 commit comments

Comments
 (0)