mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
System: Fail if use use full.conf
This commit is contained in:
parent
1bd6bfd142
commit
0d14c4b073
3 changed files with 33 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -3594,6 +3594,12 @@ srs_error_t SrsConfig::check_config()
|
|||
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;
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue