mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine the get port, return a vector<string> contains ports.
This commit is contained in:
parent
1243d962b8
commit
96e0e699dd
4 changed files with 40 additions and 22 deletions
|
@ -1175,15 +1175,6 @@ int SrsConfig::parse_buffer(_srs_internal::SrsConfigBuffer* buffer)
|
|||
return ret;
|
||||
}
|
||||
|
||||
SrsConfDirective* conf = NULL;
|
||||
// check rtmp port specified by directive listen.
|
||||
if ((conf = get_listen()) == NULL || conf->args.size() == 0) {
|
||||
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||
srs_error("line %d: conf error, "
|
||||
"directive \"listen\" is empty, ret=%d", (conf? conf->conf_line:0), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// check root directives.
|
||||
for (int i = 0; i < (int)root->directives.size(); i++) {
|
||||
SrsConfDirective* conf = root->at(i);
|
||||
|
@ -1200,6 +1191,13 @@ int SrsConfig::parse_buffer(_srs_internal::SrsConfigBuffer* buffer)
|
|||
}
|
||||
}
|
||||
|
||||
// check rtmp port specified by directive listen.
|
||||
if (_srs_config->get_listen().size() <= 0) {
|
||||
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||
srs_error("directive \"listen\" is empty, ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// TODO: FIXME: check others.
|
||||
|
||||
// check log
|
||||
|
@ -1259,9 +1257,20 @@ int SrsConfig::get_max_connections()
|
|||
return ::atoi(conf->arg0().c_str());
|
||||
}
|
||||
|
||||
SrsConfDirective* SrsConfig::get_listen()
|
||||
vector<string> SrsConfig::get_listen()
|
||||
{
|
||||
return root->get("listen");
|
||||
std::vector<string> ports;
|
||||
|
||||
SrsConfDirective* conf = root->get("listen");
|
||||
if (!conf) {
|
||||
return ports;
|
||||
}
|
||||
|
||||
for (int i = 0; i < (int)conf->args.size(); i++) {
|
||||
ports.push_back(conf->args.at(i));
|
||||
}
|
||||
|
||||
return ports;
|
||||
}
|
||||
|
||||
string SrsConfig::get_pid_file()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue