diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index ec9e53cc4..27416b7f2 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -33,7 +33,7 @@ ff_log_level info; # if console, print log to console. # if file, write log to file. requires srs_log_file if log to file. # default: file. -srs_log_tank file; +srs_log_tank console; # the log level, for all log tanks. # can be: verbose, info, trace, warn, error # default: trace @@ -48,7 +48,7 @@ max_connections 1000; # whether start as daemon # @remark: do not support reload. # default: on -daemon on; +daemon off; # whether use utc_time to generate the time struct, # if off, use localtime() to generate it, # if on, use gmtime() instead, which use UTC time. @@ -2216,3 +2216,11 @@ vhost b.origin.cluster.srs.com { coworkers 127.0.0.1:9090; } } + +############################################################################################# +# To prevent user to use full.conf +############################################################################################# +# To identify the full.conf +# @remark Should never use it directly, it's only a collections of all config items. +# Default: off +is_full on; diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index 1edee5a3d..76f86492f 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -3593,6 +3593,12 @@ srs_error_t SrsConfig::check_config() if ((err = check_number_connections()) != srs_success) { return srs_error_wrap(err, "check connections"); } + + // If use the full.conf, fail. + if (is_full_config()) { + return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, + "never use full.conf(%s)", config_file.c_str()); + } return err; } @@ -3625,7 +3631,7 @@ srs_error_t SrsConfig::check_normal_config() && n != "ff_log_level" && n != "grace_final_wait" && n != "force_grace_quit" && n != "grace_start_wait" && n != "empty_ip_ok" && n != "disable_daemon_for_docker" && n != "inotify_auto_reload" && n != "auto_reload_for_docker" && n != "tcmalloc_release_rate" - && n != "circuit_breaker" + && n != "circuit_breaker" && n != "is_full" ) { return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal directive %s", n.c_str()); } @@ -4146,6 +4152,18 @@ bool SrsConfig::get_daemon() return SRS_CONF_PERFER_TRUE(conf->arg0()); } +bool SrsConfig::is_full_config() +{ + static bool DEFAULT = false; + + SrsConfDirective* conf = root->get("is_full"); + if (!conf) { + return DEFAULT; + } + + return SRS_CONF_PERFER_FALSE(conf->arg0()); +} + SrsConfDirective* SrsConfig::get_root() { return root; diff --git a/trunk/src/app/srs_app_config.hpp b/trunk/src/app/srs_app_config.hpp index 431d09c8a..2703c226e 100644 --- a/trunk/src/app/srs_app_config.hpp +++ b/trunk/src/app/srs_app_config.hpp @@ -442,6 +442,10 @@ public: // If true, SRS will run in daemon mode, fork and fork to reap the // grand-child process to init process. virtual bool get_daemon(); +private: + // Whether user use full.conf + virtual bool is_full_config(); +public: // Get the max connections limit of system. // If exceed the max connection, SRS will disconnect the connection. // @remark, linux will limit the connections of each process,