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
2015-12-15 14:27:49 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f6ff116505f4e8c78911bd8941d4d452127b0a8a
f6ff1165
1 parent
b486f6fe
refine code, persistence use isolate method.
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
28 行增加
和
3 行删除
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/src/app/srs_app_config.cpp
查看文件 @
f6ff116
...
...
@@ -629,6 +629,11 @@ SrsConfDirective::~SrsConfDirective()
SrsConfDirective
*
SrsConfDirective
::
copy
()
{
return
copy
(
""
);
}
SrsConfDirective
*
SrsConfDirective
::
copy
(
string
except
)
{
SrsConfDirective
*
cp
=
new
SrsConfDirective
();
cp
->
conf_line
=
conf_line
;
...
...
@@ -637,7 +642,10 @@ SrsConfDirective* SrsConfDirective::copy()
for
(
int
i
=
0
;
i
<
(
int
)
directives
.
size
();
i
++
)
{
SrsConfDirective
*
directive
=
directives
.
at
(
i
);
cp
->
directives
.
push_back
(
directive
->
copy
());
if
(
!
except
.
empty
()
&&
directive
->
name
==
except
)
{
continue
;
}
cp
->
directives
.
push_back
(
directive
->
copy
(
except
));
}
return
cp
;
...
...
@@ -1982,8 +1990,8 @@ int SrsConfig::persistence()
return
ret
;
}
// persistence root directive to writer.
if
((
ret
=
root
->
persistence
(
&
fw
,
0
))
!=
ERROR_SUCCESS
)
{
// do persistence to writer.
if
((
ret
=
do_persistence
(
&
fw
))
!=
ERROR_SUCCESS
)
{
::
unlink
(
path
.
c_str
());
return
ret
;
}
...
...
@@ -2000,6 +2008,18 @@ int SrsConfig::persistence()
return
ret
;
}
int
SrsConfig
::
do_persistence
(
SrsFileWriter
*
fw
)
{
int
ret
=
ERROR_SUCCESS
;
// persistence root directive to writer.
if
((
ret
=
root
->
persistence
(
fw
,
0
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
return
ret
;
}
int
SrsConfig
::
minimal_to_json
(
SrsJsonObject
*
obj
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
f6ff116
...
...
@@ -192,6 +192,8 @@ public:
* so need to copy it to an old root directive, and use the copy result to do reload.
*/
virtual
SrsConfDirective
*
copy
();
// @param except the name of sub directive.
virtual
SrsConfDirective
*
copy
(
std
::
string
except
);
// args
public:
/**
...
...
@@ -414,6 +416,9 @@ public:
* persistence current config to file.
*/
virtual
int
persistence
();
private
:
virtual
int
do_persistence
(
SrsFileWriter
*
fw
);
public
:
/**
* dumps the global sections to json.
*/
...
...
请
注册
或
登录
后发表评论