mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for #319, support update and delete the disabled vhost
This commit is contained in:
parent
95979674f9
commit
631e76cd32
3 changed files with 110 additions and 21 deletions
|
@ -228,6 +228,14 @@ SrsConfDirective* SrsConfDirective::set_arg0(string a0)
|
|||
return this;
|
||||
}
|
||||
|
||||
void SrsConfDirective::remove(SrsConfDirective* v)
|
||||
{
|
||||
std::vector<SrsConfDirective*>::iterator it;
|
||||
if ((it = ::find(directives.begin(), directives.end(), v)) != directives.end()) {
|
||||
directives.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
bool SrsConfDirective::is_vhost()
|
||||
{
|
||||
return name == "vhost";
|
||||
|
@ -2472,6 +2480,40 @@ int SrsConfig::raw_create_vhost(string vhost, bool& applied)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsConfig::raw_update_vhost(string vhost, string name, bool& applied)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
applied = false;
|
||||
|
||||
// the vhost must be disabled, so we donot need to reload.
|
||||
SrsConfDirective* conf = root->get_or_create("vhost", vhost);
|
||||
conf->set_arg0(name);
|
||||
|
||||
applied = true;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int SrsConfig::raw_delete_vhost(string vhost, bool& applied)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
applied = false;
|
||||
|
||||
// the vhost must be disabled, so we donot need to reload.
|
||||
SrsConfDirective* conf = root->get("vhost", vhost);
|
||||
srs_assert(conf);
|
||||
|
||||
// remove the directive.
|
||||
root->remove(conf);
|
||||
srs_freep(conf);
|
||||
|
||||
applied = true;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int SrsConfig::do_reload_listen()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue