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
2013-12-06 11:00:37 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
679e851f077eeaab9d8c6104fa1e929179416251
679e851f
1 parent
48277770
support max_connections, drop if exceed.
显示空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
33 行增加
和
0 行删除
README.md
trunk/conf/srs.conf
trunk/src/core/srs_core_config.cpp
trunk/src/core/srs_core_config.hpp
trunk/src/core/srs_core_server.cpp
README.md
查看文件 @
679e851
...
...
@@ -185,6 +185,9 @@ usr sys idl wai hiq siq| read writ| recv send| in out | int csw
*
nginx v1.5.0: 139524 lines
<br/>
### History
*
v0.8, 2013-12-06, support max_connections, drop if exceed.
*
v0.8, 2013-12-05, support log_dir, write ffmpeg log to file.
*
v0.8, 2013-12-05, fix the forward/hls/encoder bug.
*
v0.7, 2013-12-03, v0.7 released. 17605 lines.
*
v0.7, 2013-12-01, support dead-loop detect for forwarder and transcoder.
*
v0.7, 2013-12-01, support all ffmpeg filters and params.
...
...
trunk/conf/srs.conf
查看文件 @
679e851
...
...
@@ -10,6 +10,10 @@ chunk_size 65000;
# if enabled ffmpeg, each stracoding stream will create a log file.
# default: ./objs/logs
log_dir
./
objs
/
logs
;
# the max connections.
# if exceed the max connections, server will drop the new connection.
# default: 2000
max_connections
2000
;
# vhost list, the __defaultVhost__ is the default vhost
# for which cannot identify the required vhost.
# for default demo.
...
...
trunk/src/core/srs_core_config.cpp
查看文件 @
679e851
...
...
@@ -916,6 +916,18 @@ std::string SrsConfig::get_log_dir()
return
conf
->
arg0
();
}
int
SrsConfig
::
get_max_connections
()
{
srs_assert
(
root
);
SrsConfDirective
*
conf
=
root
->
get
(
"max_connections"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
2000
;
}
return
::
atoi
(
conf
->
arg0
().
c_str
());
}
SrsConfDirective
*
SrsConfig
::
get_gop_cache
(
std
::
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
...
...
trunk/src/core/srs_core_config.hpp
查看文件 @
679e851
...
...
@@ -141,6 +141,7 @@ public:
virtual
void
get_engine_aparams
(
SrsConfDirective
*
engine
,
std
::
vector
<
std
::
string
>&
aparams
);
virtual
std
::
string
get_engine_output
(
SrsConfDirective
*
engine
);
virtual
std
::
string
get_log_dir
();
virtual
int
get_max_connections
();
virtual
SrsConfDirective
*
get_gop_cache
(
std
::
string
vhost
);
virtual
SrsConfDirective
*
get_forward
(
std
::
string
vhost
);
virtual
SrsConfDirective
*
get_hls
(
std
::
string
vhost
);
...
...
trunk/src/core/srs_core_server.cpp
查看文件 @
679e851
...
...
@@ -305,6 +305,19 @@ int SrsServer::accept_client(SrsListenerType type, st_netfd_t client_stfd)
{
int
ret
=
ERROR_SUCCESS
;
int
max_connections
=
config
->
get_max_connections
();
if
((
int
)
conns
.
size
()
>=
max_connections
)
{
int
fd
=
st_netfd_fileno
(
client_stfd
);
srs_error
(
"exceed the max connections, drop client: "
"clients=%d, max=%d, fd=%d"
,
(
int
)
conns
.
size
(),
max_connections
,
fd
);
st_netfd_close
(
client_stfd
);
::
close
(
fd
);
return
ret
;
}
SrsConnection
*
conn
=
NULL
;
if
(
type
==
SrsListenerStream
)
{
conn
=
new
SrsClient
(
this
,
client_stfd
);
...
...
请
注册
或
登录
后发表评论