Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-11-11 15:38:53 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
ca836cd3061819ccbf2d2839fbc177de4c4500ae
ca836cd3
2 parents
f972f9ec
2a55ae43
Merge branch 'srs.master'
显示空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
30 行增加
和
4 行删除
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.cpp
100644 → 100755
查看文件 @
ca836cd
...
...
@@ -1475,12 +1475,38 @@ int SrsConfig::check_config()
// check max connections of system limits
if
(
true
)
{
int
nb_consumed_fds
=
(
int
)
get_listen
().
size
();
if
(
get_http_api_listen
()
>
0
)
{
nb_consumed_fds
++
;
}
if
(
get_http_stream_listen
()
>
0
)
{
nb_consumed_fds
++
;
}
if
(
get_log_tank_file
())
{
nb_consumed_fds
++
;
}
// 0, 1, 2 for stdin, stdout and stderr.
nb_consumed_fds
+=
3
;
int
nb_connections
=
get_max_connections
();
int
nb_pipes
=
nb_connections
*
2
;
int
nb_reserved
=
10
;
// reserved
int
nb_total
=
nb_connections
+
nb_pipes
+
nb_consumed_fds
+
nb_reserved
;
int
max_open_files
=
sysconf
(
_SC_OPEN_MAX
);
if
(
get_max_connections
()
>
max_open_files
)
{
int
nb_canbe
=
(
max_open_files
-
(
nb_consumed_fds
+
nb_reserved
))
/
3
-
1
;
// for each play connections, we open a pipe(2fds) to convert SrsConsumver to io,
// refine performance, @see: https://github.com/winlinvip/simple-rtmp-server/issues/194
if
(
nb_total
>=
max_open_files
)
{
ret
=
ERROR_SYSTEM_CONFIG_INVALID
;
srs_error
(
"invalid max_connections=%d, system limit to %d, ret=%d. "
"you can login as root and set the limit: ulimit -HSn %d"
,
get_max_connections
(),
max_open_files
,
ret
,
get_max_connections
());
srs_error
(
"invalid max_connections=%d, required=%d, system limit to %d, "
"total=%d(max_connections=%d, nb_pipes=%d, nb_consumed_fds=%d, nb_reserved=%d), ret=%d. "
"you can change max_connections from %d to %d, or "
"you can login as root and set the limit: ulimit -HSn %d"
,
nb_connections
,
nb_total
,
max_open_files
,
nb_total
,
nb_connections
,
nb_pipes
,
nb_consumed_fds
,
nb_reserved
,
ret
,
nb_connections
,
nb_canbe
,
nb_total
);
return
ret
;
}
}
...
...
请
注册
或
登录
后发表评论