|
|
|
@ -628,6 +628,11 @@ SrsConfDirective::~SrsConfDirective()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SrsConfDirective* SrsConfDirective::copy()
|
|
|
|
|
{
|
|
|
|
|
return copy("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SrsConfDirective* SrsConfDirective::copy(string except)
|
|
|
|
|
{
|
|
|
|
|
SrsConfDirective* cp = new SrsConfDirective();
|
|
|
|
|
|
|
|
|
@ -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;
|
|
|
|
|