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-07-26 15:34:45 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ebf9e560b1aeae6debc08a026761b95e0ebee4dd
ebf9e560
1 parent
5f7ff37e
refine the max connections, compare the system ulimit max open files, error when exeed limit
隐藏空白字符变更
内嵌
并排对比
正在显示
24 个修改的文件
包含
133 行增加
和
4 行删除
trunk/conf/bandwidth.conf
trunk/conf/console.conf
trunk/conf/demo.19350.conf
trunk/conf/demo.conf
trunk/conf/dvr.segment.conf
trunk/conf/dvr.session.conf
trunk/conf/edge.conf
trunk/conf/edge.token.traverse.conf
trunk/conf/ffmpeg.transcode.conf
trunk/conf/forward.master.conf
trunk/conf/forward.slave.conf
trunk/conf/hls.conf
trunk/conf/http.heartbeat.conf
trunk/conf/http.hls.conf
trunk/conf/http.hooks.callback.conf
trunk/conf/ingest.conf
trunk/conf/origin.conf
trunk/conf/realtime.conf
trunk/conf/rtmp.conf
trunk/conf/srs.conf
trunk/conf/transcode2hls.audio.only.conf
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_log.cpp
trunk/src/utest/srs_utest_config.cpp
trunk/conf/bandwidth.conf
查看文件 @
ebf9e56
...
...
@@ -2,6 +2,7 @@
# @see full.conf for detail config.
listen
1935
;
max_connections
1000
;
vhost
__
defaultVhost__
{
}
...
...
trunk/conf/console.conf
查看文件 @
ebf9e56
...
...
@@ -2,6 +2,7 @@
# @see full.conf for detail config.
listen
1935
;
max_connections
1000
;
daemon
off
;
srs_log_tank
console
;
http_api
{
...
...
trunk/conf/demo.19350.conf
查看文件 @
ebf9e56
...
...
@@ -3,6 +3,7 @@
# @see full.conf for detail config.
listen
19350
;
max_connections
1000
;
daemon
on
;
srs_log_tank
file
;
srs_log_file
./
objs
/
srs
.
demo
.
19350
.
log
;
...
...
trunk/conf/demo.conf
查看文件 @
ebf9e56
...
...
@@ -3,6 +3,7 @@
# @see full.conf for detail config.
listen
1935
;
max_connections
1000
;
daemon
on
;
srs_log_tank
file
;
srs_log_file
./
objs
/
srs
.
demo
.
log
;
...
...
trunk/conf/dvr.segment.conf
查看文件 @
ebf9e56
...
...
@@ -3,6 +3,7 @@
# @see full.conf for detail config.
listen
1935
;
max_connections
1000
;
vhost
__
defaultVhost__
{
dvr
{
enabled
on
;
...
...
trunk/conf/dvr.session.conf
查看文件 @
ebf9e56
...
...
@@ -3,6 +3,7 @@
# @see full.conf for detail config.
listen
1935
;
max_connections
1000
;
vhost
__
defaultVhost__
{
dvr
{
enabled
on
;
...
...
trunk/conf/edge.conf
查看文件 @
ebf9e56
...
...
@@ -3,6 +3,7 @@
# @see full.conf for detail config.
listen
1935
;
max_connections
1000
;
pid
objs
/
edge
.
pid
;
srs_log_file
./
objs
/
edge
.
log
;
vhost
__
defaultVhost__
{
...
...
trunk/conf/edge.token.traverse.conf
查看文件 @
ebf9e56
...
...
@@ -2,7 +2,8 @@
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/DRM
# @see full.conf for detail config.
listen
1935
;
listen
1935
max_connections
1000
;
vhost
__
defaultVhost__
{
mode
remote
;
origin
127
.
0
.
0
.
1
:
19350
;
...
...
trunk/conf/ffmpeg.transcode.conf
查看文件 @
ebf9e56
...
...
@@ -3,6 +3,7 @@
# @see full.conf for detail config.
listen
1935
;
max_connections
1000
;
vhost
__
defaultVhost__
{
transcode
{
enabled
on
;
...
...
trunk/conf/forward.master.conf
查看文件 @
ebf9e56
...
...
@@ -3,6 +3,7 @@
# @see full.conf for detail config.
listen
1935
;
max_connections
1000
;
pid
./
objs
/
srs
.
master
.
pid
;
srs_log_tank
file
;
srs_log_file
./
objs
/
srs
.
master
.
log
;
...
...
trunk/conf/forward.slave.conf
查看文件 @
ebf9e56
...
...
@@ -3,6 +3,7 @@
# @see full.conf for detail config.
listen
19350
;
max_connections
1000
;
pid
./
objs
/
srs
.
slave
.
pid
;
srs_log_tank
file
;
srs_log_file
./
objs
/
srs
.
slave
.
log
;
...
...
trunk/conf/hls.conf
查看文件 @
ebf9e56
...
...
@@ -3,6 +3,7 @@
# @see full.conf for detail config.
listen
1935
;
max_connections
1000
;
vhost
__
defaultVhost__
{
hls
{
enabled
on
;
...
...
trunk/conf/http.heartbeat.conf
查看文件 @
ebf9e56
# the config for srs http heartbeat, report its info to api-server
# @see full.conf for detail config.
listen
1935
;
listen
1935
max_connections
1000
;
heartbeat
{
enabled
on
;
interval
9
.
3
;
...
...
trunk/conf/http.hls.conf
查看文件 @
ebf9e56
...
...
@@ -3,6 +3,7 @@
# @see full.conf for detail config.
listen
1935
;
max_connections
1000
;
http_stream
{
enabled
on
;
listen
8080
;
...
...
trunk/conf/http.hooks.callback.conf
查看文件 @
ebf9e56
...
...
@@ -2,6 +2,7 @@
# @see full.conf for detail config.
listen
1935
;
max_connections
1000
;
srs_log_tank
file
;
srs_log_file
./
objs
/
srs
.
log
;
vhost
__
defaultVhost__
{
...
...
trunk/conf/ingest.conf
查看文件 @
ebf9e56
...
...
@@ -3,6 +3,7 @@
# @see full.conf for detail config.
listen
1935
;
max_connections
1000
;
vhost
__
defaultVhost__
{
ingest
livestream
{
enabled
on
;
...
...
trunk/conf/origin.conf
查看文件 @
ebf9e56
...
...
@@ -3,6 +3,7 @@
# @see full.conf for detail config.
listen
19350
;
max_connections
1000
;
pid
objs
/
origin
.
pid
;
srs_log_file
./
objs
/
origin
.
log
;
vhost
__
defaultVhost__
{
...
...
trunk/conf/realtime.conf
查看文件 @
ebf9e56
...
...
@@ -3,6 +3,7 @@
# @see full.conf for detail config.
listen
1935
;
max_connections
1000
;
vhost
__
defaultVhost__
{
gop_cache
off
;
queue_length
10
;
...
...
trunk/conf/rtmp.conf
查看文件 @
ebf9e56
...
...
@@ -3,5 +3,6 @@
# @see full.conf for detail config.
listen
1935
;
max_connections
1000
;
vhost
__
defaultVhost__
{
}
...
...
trunk/conf/srs.conf
查看文件 @
ebf9e56
...
...
@@ -2,6 +2,7 @@
# @see full.conf for detail config.
listen
1935
;
max_connections
1000
;
srs_log_tank
file
;
srs_log_file
./
objs
/
srs
.
log
;
http_api
{
...
...
trunk/conf/transcode2hls.audio.only.conf
查看文件 @
ebf9e56
...
...
@@ -3,6 +3,7 @@
# @see full.conf for detail config.
listen
1935
;
max_connections
1000
;
vhost
__
defaultVhost__
{
hls
{
enabled
on
;
...
...
trunk/src/app/srs_app_config.cpp
查看文件 @
ebf9e56
...
...
@@ -23,6 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_config.hpp>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
...
...
@@ -1405,6 +1406,18 @@ int SrsConfig::check_config()
return
ret
;
}
// check max connections of system limits
if
(
true
)
{
int
max_open_files
=
sysconf
(
_SC_OPEN_MAX
);
if
(
get_max_connections
()
>
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
());
return
ret
;
}
}
////////////////////////////////////////////////////////////////////////
// check heartbeat
////////////////////////////////////////////////////////////////////////
...
...
trunk/src/app/srs_app_log.cpp
查看文件 @
ebf9e56
...
...
@@ -197,7 +197,9 @@ void SrsFastLog::error(const char* tag, int context_id, const char* fmt, ...)
va_end
(
ap
);
// add strerror() to error msg.
size
+=
snprintf
(
log_data
+
size
,
LOG_MAX_SIZE
-
size
,
"(%s)"
,
strerror
(
errno
));
if
(
errno
!=
0
)
{
size
+=
snprintf
(
log_data
+
size
,
LOG_MAX_SIZE
-
size
,
"(%s)"
,
strerror
(
errno
));
}
write_log
(
fd
,
log_data
,
size
,
SrsLogLevel
::
Error
);
}
...
...
trunk/src/utest/srs_utest_config.cpp
查看文件 @
ebf9e56
...
...
@@ -1787,11 +1787,13 @@ VOID TEST(ConfigMainTest, ParseEmpty)
VOID
TEST
(
ConfigMainTest
,
ParseMinConf
)
{
MockSrsConfig
conf
;
EXPECT_TRUE
(
ERROR_SUCCESS
==
conf
.
parse
(
"listen 1935;"
));
EXPECT_TRUE
(
ERROR_SUCCESS
==
conf
.
parse
(
"listen 1935;
max_connections 1000;
"
));
vector
<
string
>
listens
=
conf
.
get_listen
();
EXPECT_EQ
(
1
,
(
int
)
listens
.
size
());
EXPECT_STREQ
(
"1935"
,
listens
.
at
(
0
).
c_str
());
EXPECT_EQ
(
1000
,
conf
.
get_max_connections
());
}
VOID
TEST
(
ConfigMainTest
,
ParseInvalidDirective
)
...
...
@@ -4364,3 +4366,94 @@ VOID TEST(ConfigMainTest, CheckConf_listen)
EXPECT_TRUE
(
ERROR_SUCCESS
!=
conf
.
parse
(
"listen -1935;"
));
}
}
VOID
TEST
(
ConfigMainTest
,
CheckConf_pid
)
{
if
(
true
)
{
MockSrsConfig
conf
;
EXPECT_TRUE
(
ERROR_SUCCESS
!=
conf
.
parse
(
"pids ./objs/srs.pid;"
));
}
}
VOID
TEST
(
ConfigMainTest
,
CheckConf_chunk_size
)
{
if
(
true
)
{
MockSrsConfig
conf
;
EXPECT_TRUE
(
ERROR_SUCCESS
!=
conf
.
parse
(
"chunk_sizes 60000;"
));
}
if
(
true
)
{
MockSrsConfig
conf
;
EXPECT_TRUE
(
ERROR_SUCCESS
!=
conf
.
parse
(
"chunk_size 0;"
));
}
if
(
true
)
{
MockSrsConfig
conf
;
EXPECT_TRUE
(
ERROR_SUCCESS
!=
conf
.
parse
(
"chunk_size 1;"
));
}
if
(
true
)
{
MockSrsConfig
conf
;
EXPECT_TRUE
(
ERROR_SUCCESS
!=
conf
.
parse
(
"chunk_size 127;"
));
}
if
(
true
)
{
MockSrsConfig
conf
;
EXPECT_TRUE
(
ERROR_SUCCESS
!=
conf
.
parse
(
"chunk_size -1;"
));
}
if
(
true
)
{
MockSrsConfig
conf
;
EXPECT_TRUE
(
ERROR_SUCCESS
!=
conf
.
parse
(
"chunk_size -4096;"
));
}
if
(
true
)
{
MockSrsConfig
conf
;
EXPECT_TRUE
(
ERROR_SUCCESS
!=
conf
.
parse
(
"chunk_size 65536;"
));
}
}
VOID
TEST
(
ConfigMainTest
,
CheckConf_ff_log_dir
)
{
if
(
true
)
{
MockSrsConfig
conf
;
EXPECT_TRUE
(
ERROR_SUCCESS
!=
conf
.
parse
(
"ff_log_dirs ./objs;"
));
}
}
VOID
TEST
(
ConfigMainTest
,
CheckConf_srs_log_level
)
{
if
(
true
)
{
MockSrsConfig
conf
;
EXPECT_TRUE
(
ERROR_SUCCESS
!=
conf
.
parse
(
"srs_log_levels trace;"
));
}
}
VOID
TEST
(
ConfigMainTest
,
CheckConf_srs_log_file
)
{
if
(
true
)
{
MockSrsConfig
conf
;
EXPECT_TRUE
(
ERROR_SUCCESS
!=
conf
.
parse
(
"srs_log_files ./objs/srs.log;"
));
}
}
VOID
TEST
(
ConfigMainTest
,
CheckConf_max_connections
)
{
if
(
true
)
{
MockSrsConfig
conf
;
EXPECT_TRUE
(
ERROR_SUCCESS
!=
conf
.
parse
(
"max_connectionss 1000;"
));
}
if
(
true
)
{
MockSrsConfig
conf
;
EXPECT_TRUE
(
ERROR_SUCCESS
!=
conf
.
parse
(
"max_connections 0;"
));
}
}
VOID
TEST
(
ConfigMainTest
,
CheckConf_
)
{
if
(
true
)
{
MockSrsConfig
conf
;
EXPECT_TRUE
(
ERROR_SUCCESS
!=
conf
.
parse
(
"listens 1935;"
));
}
}
...
...
请
注册
或
登录
后发表评论