1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-15 04:42:04 +00:00

Merge branch '4.0release' into merge/develop

This commit is contained in:
winlin 2021-05-18 11:46:46 +08:00
commit 98cd8145cc
5 changed files with 44 additions and 13 deletions

View file

@ -1,5 +1,6 @@
CONTRIBUTORS ordered by first contribution.
* winlin<winlin@vip.126.com>
* chengli.ycl<chengli.ycl@alibaba-inc.com>
* wenjie.zhao<740936897@qq.com>
* xiangcheng.liu<liuxc0116@foxmail.com>
* naijia.liu<youngcow@youngcow.net>
@ -58,13 +59,16 @@ CONTRIBUTORS ordered by first contribution.
* XiaLixin<xialx@yuntongxun.com>
* xiaozhihong<xiaozhihong8@gmail.com>
* HuyaJohn<xiaozhihong@huya.com>
* xiaozhihong<hondaxiao@tencent.com>
* yanghuiwen<cainiaodj@qq.com>
* Bepartofyou<309554135@qq.com>
* pengqiang.wpq<pengqiang.wpq@alibaba-inc.com>
* l<22312935+lam2003@users.noreply.github.com>
* xfalcon<x-falcon@users.noreply.github.com>
* cgh<jinxue.cgh@alibaba-inc.com>
* LiPeng<mozhan.lp@alibaba-inc.com>
* xiaozhihong<hondaxiao@tencent.com>
* chengh_math<chengh_math@126.com>
* jinxue.cgh<jinxue.cgh@alibaba-inc.com>
* lipeng19811218<lipeng19811218@gmail.com>
* mozhan.lp<mozhan.lp@alibaba-inc.com>
* yajun18<yajun18@staff.sina.com.cn>
* liulichuan<liulichuan@kuaishou.com>
* yapingcat<caoyapingneu@163.com>

View file

@ -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.
@ -2228,3 +2228,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;

View file

@ -7,14 +7,11 @@ authors=`git log --format='%ae'|grep -v localhost|grep -v demo|grep -v none|sort
if [[ $? -ne 0 ]]; then echo "no authors"; exit -1; fi
for author in $authors; do
echo $author| grep 'winlin' >/dev/null 2>&1 && continue;
echo $author| grep 'winterserver' >/dev/null 2>&1 && continue;
echo $author| grep 'chengli.ycl' >/dev/null 2>&1 && continue;
echo $author| grep 'wenjie.zhao' >/dev/null 2>&1 && continue;
echo $author| grep 'zhaowenjie' >/dev/null 2>&1 && continue;
echo $author| grep 'pengqiang.wpq' >/dev/null 2>&1 && continue;
echo $author| grep -e "winlin" -e 'winterserver' \
-e 'zhaowenjie' >/dev/null 2>&1 && continue;
grep $author $AFILE 1>/dev/null 2>/dev/null && continue;
username=$(echo $author |awk -F '@' '{print $1}')
grep $username $AFILE 1>/dev/null 2>/dev/null && continue;
git log -1 --author="$author" --format='%an<%ae>'| sed 's/ //g'
done

View file

@ -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;

View file

@ -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,